Fredrik Lundh, Tera 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
individual
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 database
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, where one
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 usually
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
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()