hello
how can i read image from clipboard ?
i was only able to raed text using wx.clipboard. but not images
is it possible to read images with wx.clipboard?
or there is another way?
i use python2.5 and windows vita 64 bit
thanks in advance
hello
how can i read image from clipboard ?
i was only able to raed text using wx.clipboard. but not images
is it possible to read images with wx.clipboard?
or there is another way?
i use python2.5 and windows vita 64 bit
thanks in advance
The following works for me (tested on Mac OSX)
import wx
class MyFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, 'test frame',size=(790, 524))
self.Bind(wx.EVT_LEFT_DOWN, self.OnClick)
self.Bind(wx.EVT_PAINT, self.OnPaint)
self.clip = wx.Clipboard()
self.x = wx.BitmapDataObject()
self.bmp = None
def OnClick(self, evt):
self.clip.Open()
self.clip.GetData(self.x)
self.clip.Close()
self.bmp = self.x.GetBitmap()
self.Refresh()
def OnPaint(self, evt):
if self.bmp:
dc = wx.PaintDC(self)
dc.DrawBitmap(self.bmp, 20, 20, True)
if __name__ == '__main__':
app = wx.App()
frame = MyFrame()
frame.Show()
app.MainLoop()
To use this, I run it and when the frame comes up I copy an image using another program and then click in the wx frame, which then causes the copied image to be drawn within it.