[wxPython-users] Re: Clipboard refuses

Egbert Bouwman egbert.bouwman at xs4all.nl
Sat Feb 2 03:52:44 PST 2008


Hello Robin et alii,
On Fri, 2008-02-01 at 08:35 -0800, Robin Dunn wrote
about my question on a non responding clipboard after closing my
wxPython experiment:

> Not sure, the Flush appears to be working for me.  Please let us know 
> your platform and version.

Debian Testing and maybe still some Unstable. 
Linux kernel 2.6.21-2-686
Gnome version 2.18.3
Python 2.4.4-6 
python-wxgtk2.6  2.6.3.2.2-1
> 
> BTW, if you're using a Unicode build of wxPython then you should do this 
> in case the system locale is not using the latin-1 encoding:
> 
>          latin1 =wx.TextDataObject("sm\xf8rebr\xf8d".decode("latin-1"))
Thanks. In my head the latin-1 and unicode intricacies are still a
muddle.

Her follows my script again, a bit reorganised, but still not working
well:

#!/usr/bin/env python
import wx
class Raam(wx.Frame):
    def __init__(self,titel,pos,size):
        wx.Frame.__init__(self, None, -1, titel, pos, size)
        self.knop = wx.Button(self, -1, "KNOP")
        self.Bind(wx.EVT_BUTTON, self.klipper, self.knop)
        
    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()
            
    def OnQuit(self, event):
        self.Close()
        
class App(wx.App):
    def OnInit(self):
        self.raam = Raam("Experiment with clipboard",(20,30), (50,40))
        self.SetExitOnFrameDelete(True) # Default.
        self.raam.Show()
        self.SetTopWindow(self.raam)
        return True
        
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