1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
|
.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2018 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. _wx.Metafile:
==========================================================================================================================================
|phoenix_title| **wx.Metafile**
==========================================================================================================================================
A ** :ref:`wx.Metafile` ** represents the MS Windows metafile object, so metafile operations have no effect in X.
In wxWidgets, only sufficient functionality has been provided for copying a graphic to the clipboard; this may be extended in a future version.
Presently, the only way of creating a metafile is to use a :ref:`wx.MetafileDC`.
.. availability:: Only available for MSW.
.. seealso:: :ref:`wx.MetafileDC`
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html
<div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
<img id="toggleBlock-trigger" src="_static/images/closed.png"/>
Inheritance diagram for class <strong>Metafile</strong>:
</div>
<div id="toggleBlock-summary" style="display:block;"></div>
<div id="toggleBlock-content" style="display:none;">
<p class="graphviz">
<center><img src="_static/images/inheritance/wx.Metafile_inheritance.png" alt="Inheritance diagram of Metafile" usemap="#dummy" class="inheritance"/></center>
</div>
<script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
<map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.Object.html" title="wx.Object" alt="" coords="9,5,91,35"/> <area shape="rect" id="node2" href="wx.Metafile.html" title="wx.Metafile" alt="" coords="5,83,96,112"/> </map>
</p>
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.Metafile.__init__` Constructor.
:meth:`~wx.Metafile.IsOk` Returns ``True`` if the metafile is valid.
:meth:`~wx.Metafile.Play` Plays the metafile into the given device context, returning ``True`` if successful.
:meth:`~wx.Metafile.SetClipboard` Passes the metafile data to the clipboard.
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: wx.Metafile(Object)
**Possible constructors**::
Metafile(filename=EmptyString)
A Metafile represents the MS Windows metafile object, so metafile
operations have no effect in X.
.. method:: __init__(self, filename=EmptyString)
Constructor.
If a filename is given, the Windows disk metafile is read in. Check whether this was performed successfully by using the :meth:`IsOk` member.
:param `filename`:
:type `filename`: string
.. method:: IsOk(self)
Returns ``True`` if the metafile is valid.
:rtype: `bool`
.. method:: Play(self, dc)
Plays the metafile into the given device context, returning ``True`` if successful.
:param `dc`:
:type `dc`: wx.DC
:rtype: `bool`
.. method:: SetClipboard(self, width=0, height=0)
Passes the metafile data to the clipboard.
The metafile can no longer be used for anything, but the :ref:`wx.Metafile` object must still be destroyed by the application.
Below is a example of metafile, metafile device context and clipboard use from the ``hello.cpp`` example. Note the way the metafile dimensions are passed to the clipboard, making use of the device context's ability to keep track of the maximum extent of drawing commands.
::
dc = wx.MetafileDC()
if dc.IsOk():
self.Draw(dc)
mf = dc.Close()
if mf:
mf.SetClipboard(dc.MaxX() + 10, dc.MaxY() + 10)
:param `width`:
:type `width`: int
:param `height`:
:type `height`: int
:rtype: `bool`
|