Clipboard refuses
Egbert Bouwman
egbert.bouwman at xs4all.nl
Fri Feb 1 01:39:22 PST 2008
On Fri, 2008-02-01 at 10:36 +0100, Egbert Bouwman wrote:
> Hello,
> In the following experiment I write something to the clipboard, and I
> can retrieve it from there in an other application (Evolution),
> but only as long as this experiment is still running, despite the
> Flush(). What am I doing wrong ?
Awfully sorry, I forgot to insert something:
import wx
import wx.lib.buttons as buttons
class Raam(wx.Frame):
def __init__(self,titel,pos,size):
wx.Frame.__init__(self, None, -1, titel, pos, size)
def OnQuit(self, event):
self.Close()
class App(wx.App):
def OnInit(self):
self.raam = Raam("Experiment with clipboard",(20,30), (450,340))
self.SetExitOnFrameDelete(True) # Default. False: app loopt tot
wx.Exit()
self.knop = wx.Button(self.raam, -1, "KNOP")
self.Bind(wx.EVT_BUTTON, self.klipper, self.knop)
self.raam.Show()
self.SetTopWindow(self.raam)
return True
def klipper(self, event):
latin1 =wx.TextDataObject("sm\xf8rebr\xf8d")
print "Experiment with latin-1: %s" % latin1.GetText()
if wx.TheClipboard.Open():
wx.TheClipboard.SetData(latin1)
wx.TheClipboard.Flush()
wx.TheClipboard.Close()
app = App()
app.MainLoop()
> e
--
Egbert Bouwman
Keizersgracht 197-II
1016 DS Amsterdam
Tel 0(031)20 6257991
More information about the wxpython-users
mailing list