[wxpython-users] All FileDialogs on frame open after single button click

Werner F. Bruhin werner.bruhin at free.fr
Sat Sep 20 22:27:37 PDT 2008


Hi,

Durand wrote:
> Hiya,
>
> I'm getting this really, really weird problem where all my Open 
> Dialogs open one after the other even though I only press the button 
> for the first one. I'm new to wxPython but I can't really see where 
> I've gone wrong here... 
>
> Well, here's the script: http://pastebin.ca/1206796 
>   
You are binding the event to the frame instead of to the individual 
buttons, change the bind to this:
        self.tremcs_dir_open.Bind(wx.EVT_BUTTON, 
self.OpenTremCS,self.tremcs_dir_open)
        self.trem_dir_open.Bind(wx.EVT_BUTTON, 
self.OpenTrem,self.trem_dir_open)
        self.theme_open.Bind(wx.EVT_BUTTON, self.OpenTheme,self.theme_open)
        self.convert_path_open.Bind(wx.EVT_BUTTON, self.ChooseIM, 
self.convert_path_open)
        self.graph_live_open.Bind(wx.EVT_BUTTON, 
self.SaveGraphFile,self.graph_live_open)

In the button event handlers you do not need the event.Skip(), also it 
doesn't hurt.

Werner


More information about the wxpython-users mailing list