Re: how to pass globals across modules (wxPython)

2004-12-22 Thread Jorge Luiz Godoy Filho
Fredrik Lundh, TerÃa 21 Dezembro 2004 16:33, wrote: > well, in my applications, subsystems usually consists of one or more > classes, or at least > one or more functions. code that needs the global context usually gets > the content either as a constructor argument, or as an argument to > individ

Re: how to pass globals across modules (wxPython)

2004-12-21 Thread Fredrik Lundh
Jorge Luiz Godoy Filho wrote: > > or a single "application context class" instance, which is passed to > > various parts of the system as necessary. > > Wouldn't that cause a chicken & egg problem? How, then, would one pass such > an instance across modules? well, in my applications, subsystems

Re: how to pass globals across modules (wxPython)

2004-12-21 Thread Jorge Luiz Godoy Filho
Fredrik Lundh, TerÃa 21 Dezembro 2004 14:02, wrote: > or a single "application context class" instance, which is passed to > various parts of the system as necessary. Wouldn't that cause a chicken & egg problem? How, then, would one pass such an instance across modules? I'm sorry for my ignoran

Re: how to pass globals across modules (wxPython)

2004-12-21 Thread Fredrik Lundh
Jorge Luiz Godoy Filho wrote: >> An even better approach might be to find a way to avoid >> having to access the main window through a global, but >> I'll have to leave this up to you, as it may depend on >> your program structure. > > This might be a problem also to share a database connection, w

Re: how to pass globals across modules (wxPython)

2004-12-21 Thread Jorge Luiz Godoy Filho
Peter Hansen, Segunda 20 Dezembro 2004 08:01, wrote: > An even better approach might be to find a way to avoid > having to access the main window through a global, but > I'll have to leave this up to you, as it may depend on > your program structure. This might be a problem also to share a databa

Re: how to pass globals across modules (wxPython)

2004-12-20 Thread Hans Nowak
Martin Drautzburg wrote: My wxPython program starts execution in mainFrame.py like this [...] class MainApp(wxApp): def OnInit(self): self.mainFrame = MainFrame(None) self.mainFrame.Show() self.S

Re: how to pass globals across modules (wxPython)

2004-12-20 Thread Larry Bates
I also struggled with this until I looked into many of the wxWindows examples. They all tend to pass in the parent to each subsequent layer of classes so that they can easily refer backwards in the hierarchy. Example In your code you will find that inside of SetTopWindow you have parent as the fir

Re: how to pass globals across modules (wxPython)

2004-12-20 Thread Peter Hansen
Martin Drautzburg wrote: My wxPython program starts execution in mainFrame.py like this def main(): global application application=MainApp(0) application.MainLoop() I need to access the "application" object from other modules, actually the win

Re: how to pass globals across modules (wxPython)

2004-12-19 Thread Fredrik Lundh
Martin Drautzburg wrote: > My wxPython program starts execution in mainFrame.py like this >[...] >class MainApp(wxApp): >def OnInit(self): >self.mainFrame = MainFrame(None) >self.mainFrame.Show() >