[wxPython] Passing information from the app to the frame...

Today I'm a little bit confused, so ignore this post
if it was completly wrong *g*
i think (in my confusedness) that you want to do this?

class MyFrame(wxFrame):
    ...

    def SetObject(self,obj):
          self.obj=obj
          EVT_BUTTON(...)

That's more or less what I was after, and your solution seems to be a good
one.

class MyApp(wxApp):
    def OnInit(self):
        frame = MyFrame(...)
        SetTopWindow(frame)
        frame.Show(true)

         frame.SetObject(ActiveScripting)

        return true

The only problem I have is that I do not create the ActiveScripting object
here. I do it in the main code (below). So I guess I need

    def SetObject(self, obj):
        self.frame.SetObject(obj)

... and then I need to retain the frame in an instance variable. Then, in
the main code below, I do

if __name__ == "__main__":
    app = MyApp(0)

       app.SetObject(ActiveScripting())

    app.MainLoop()

Hope, this won't spend more confuse.

No, that's a workable solution. But it still feels to me like there should
be a "better" way, somewhere. I'll use this approach, but I'd be interested
in what other people think as well...

Paul.

···

From: Rene Freund [mailto:rene@meder.de]

.....

The only problem I have is that I do not create the ActiveScripting object
here. I do it in the main code (below). So I guess I need

    def SetObject(self, obj):
        self.frame.SetObject(obj)

... and then I need to retain the frame in an instance variable. Then, in
the main code below, I do

if __name__ == "__main__":
    app = MyApp(0)

       app.SetObject(ActiveScripting())

    app.MainLoop()

What about this...

in MyApp:

      self.frame=frame

then later before app.MainLoop())
      app.frame.SetObject(ActiveScripting())

i don't know if this works... i haven't tried this...
Only another stupid idea *smile*

reen

···

--On Freitag, 27. Juli 2001 14:54 +0100 "Moore, Paul" <Paul.Moore@atosorigin.com> wrote: