A ** wx.msw.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 wx.msw.MetafileDC.
Availability
Only available for MSW.
See also
__init__ |
Constructor. |
IsOk |
Returns True if the metafile is valid. |
Play |
Plays the metafile into the given device context, returning True if successful. |
SetClipboard |
Passes the metafile data to the clipboard. |
wx.msw.
Metafile
(Object)¶Possible constructors:
Metafile(filename="")
A Metafile represents the MS Windows metafile object, so metafile operations have no effect in X.
__init__
(self, filename="")¶Constructor.
If a filename is given, the Windows disk metafile is read in. Check whether this was performed successfully by using the IsOk
member.
Parameters: | filename (string) – |
---|
IsOk
(self)¶Returns True
if the metafile is valid.
Return type: | bool |
---|
Play
(self, dc)¶Plays the metafile into the given device context, returning True
if successful.
Parameters: | dc (wx.DC) – |
---|---|
Return type: | bool |
SetClipboard
(self, width=0, height=0)¶Passes the metafile data to the clipboard.
The metafile can no longer be used for anything, but the wx.msw.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.DoDrawing(dc)
metafile = dc.Close()
if metafile:
success = metafile.SetClipboard(dc.MaxX() + 10, dc.MaxY() + 10)
Parameters: |
|
---|---|
Return type: | bool |