Hi,
I encountered some strange event processing when using a wxFileDialog which is demonstrated in the following example. I'm using wxPyhton 2.5.2.8 GTK2 on linux.
When double clicking on any file in the dialog, it closes as expected but there is a remaining LEFT_UP event coming from the underlying panel in case that the dialog opened on top of the main frame. This does not happen if one exits the dialog by clicking on 'Ok'. That means that the dialog is already closed after the second LEFT_DOWN of the double click. Is that behaviour wanted and if yes, does anyone have a good idea how to catch these events?
the example:
import os
import wx
class TestPanel(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent, -1)
b = wx.Button(self, -1, "Create and Show an OPEN FileDialog")
self.Bind(wx.EVT_BUTTON, self.OnButton, b)
self.Bind(wx.EVT_LEFT_UP, self.OnMouse)
def OnButton(self, evt):
dlg = wx.FileDialog(
self, message="Choose a file", defaultDir=os.getcwd(),
defaultFile="", style=wx.OPEN | wx.MULTIPLE | wx.CHANGE_DIR
)
if dlg.ShowModal() == wx.ID_OK:
# This returns a Python list of files that were selected.
paths = dlg.GetPaths()
dlg.Destroy()
def OnMouse(self, evt):
print evt.GetEventObject()
class RunDemoApp(wx.App):
def __init__(self, name):
self.name = name
wx.App.__init__(self)
def OnInit(self):
frame = wx.Frame(None, -1, self.name, size=(800,600))
frame.Show(True)
frame.panel = TestPanel(frame)
self.frame = frame
return True
def OnCloseFrame(self, evt):
self.frame.Close()
evt.Skip()
if __name__ == "__main__":
app = RunDemoApp('test')
app.MainLoop()
Regards, Christian