[wxPython-users] Re: Problem with wx.lib.pubsub

Christopher Barker Chris.Barker at noaa.gov
Thu Sep 20 11:39:31 PDT 2007


Steve Senior wrote:
> Previously I was calling the model.SecondOne() function like this:

>     def SetUserPrefs(self):
>         model.SecondOne("BUTTONPANEL_BORDER_COLOR")
> 
> and this didn't work.
> 
> Then when I changed it to this:
>     def __init__(self):
>         wx.Frame.__init__(self, None, -1, "MyApp", 
> 
>         # Get and set the users preferences from the database
>         model.SecondOne("BUTTONPANEL_BORDER_COLOR")

> i.e. I pulled it out of the SetUserPrefs method, the message was received and 
> processed!
> 
> Why can't I do it the original way from within the SetUserPrefs method?

What namespace is "model" in? Maybe you don't have access to it in the 
SetUserPrefs() method -- should it be self.model? wx.GetApp().model?

Have you got your app set up so that you see the standard error 
messages? If there is an error in a callback, wxPython won't stop, but 
it will print an error, so you want to make sure you can see those when 
testing.

Again -- make a small, self-contained sample, and we can really tell you 
what's going on (or, quite likely, you'll figure it out yourself when 
you isolate the code).

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov




More information about the wxpython-users mailing list