FileBrowseButton does not work on Windows XP (does not react to clicks)

Hi,

in my program, I have a little custom dialog displaying the paths to some linked files to the user, together with buttons that allow the user to change/update these paths if necessary. The buttons are all instances of wx.lib.filebrowsebutton.FileBrowseButton.

My (very simple) problem: The buttons do not work on Windows XP. (They were working just fine on my Mac, where I ran the program first.) They don’t DO anything. They’re sitting there, looking all nicely button-like… until you actually try to click them. Then nothing happens at all - no file dialog, no error message, no crashes. Nothing.

Python 2.7.4
wxPython 2.8.12.1

Can anybody help?

Many thanks,

Ingrid

FileBrowseButton_problem_XP.py (2.23 KB)

To be able to fully diagnose the problem only a small, runnable example could for sure tell where the problem is (Minimal Sample from the FAQ):

However, at least in your sample code I cannot see from where the method GetValues(self) is getting called. Is it bound from outside of your class PathDialogs? Just check the wxPython Demo for an example.

In your case I spot following issues:

First, the FileBrowseButton has self as parent. It cannot be clicked in Windows. Instead parent it to self.panel, then the button will work (albeit not call GetValues)

Second, there is no method bound to the FileBrowseButton, GetValues() is never called. See the parameter changeCallback of File browse button.

Third, you will have to give your GetValues method a parameter event

In your case I spot following issues:

First, the FileBrowseButton has self as parent. It cannot be clicked in Windows. Instead parent it to self.panel, then the button will work (albeit not call GetValues)

Hah!! That was it; thank you so much!!! I changed the parent to self.panel and it’s working fine now.

Second, there is no method bound to the FileBrowseButton, GetValues() is never called. See the parameter changeCallback of File browse button.

Third, you will have to give your GetValues method a parameter event

The button actually already comes with a bound method - it opens a file browser and lets the user choose a file, so it doesn’t need another method to be bound to it. It’s not supposed to call GetValues(). The GetValues() method is called from outside the dialog, after ascertaining that the user ended it by clicking on “OK”:

pd = PathsDialog(…)
if pd.ShowModal() == wx.ID_OK:
new_paths = pd.GetValues()
pd.Destroy()

But never mind that; it’s working now!

Again, many thanks!

Ingrid