[wxPython-users] Drag n' Drop works different for Unicode and ANSI versions of wxPython

Chris Mellon arkanes at gmail.com
Thu Aug 2 08:22:12 PDT 2007


On 8/2/07, Ophir Horowitz <Ophir at egloomedia.com> wrote:
>
>
>
>
> Hi!
>
>
>
> I use python2.4 with wxPython 2.8.4.0 Unicode and I have encountered a weird
> problem with Drag n' Drop.
>
> I want to drag texts from my application and drop them on a text box inside
> a browser.
>
> When I wrote this code a weird thing happened: it worked only in Firefox and
> not in Internet Explorer.
>
> Even weirder is the fact that when I uninstalled the wxPython Unicode
> version and installed the ANSI version, the Drag n' Drop started to work!
>
>
>
> Of course, this is not a solution, because I need Unicode support in my
> application…
>
>
>
> Here's a simplified code that shows the problem:
>
> import wx
>
> app=wx.PySimpleApp()
>
> def press(evt):
>
>     text_object=wx.TextDataObject()
>
>     text_object.SetText(txt.GetValue())
>
>     dropSource = wx.DropSource(txt)
>
>     dropSource.SetData(text_object)
>
>     result = dropSource.DoDragDrop(wx.Drag_CopyOnly)
>
>
>
> frame = wx.Frame(None,size=(200,200))
>
> frame.SetBackgroundColour("#EEEEEE")
>
> txt = wx.TextCtrl(frame,-1,pos=(50,50))
>
> txt.SetValue('hello')
>
> txt.Bind(wx.EVT_LEFT_DOWN,press)
>
> frame.Show()
>
> app.MainLoop()
>
>
>
> Can someone please help?
>
>
>
> Thanks,
>
> Ophir


There's probably another text data format that wxTextDataCtrl needs to
advertise as supporting. Please file a bug report on SF as win32
specific.

As a workaround, you can use the wx.TE_RICH flag, which has native
drag and drop support.




More information about the wxpython-users mailing list