I have a wxPython app, conventionally structured
with a Application class derived from wx.App.
My problem is that the app accepts a command
line argument that must be acted upon within the
OnInit() method of the Application class. How do
I pass it cleanly from main() into app.OnInit()? In
the simplified example below, dbfn is the piece of
info that is in main() that OnInit() needs to use.
Is a global variable is the only way? :-(
class Application (wx.App):
def OnInit (self):
oper = Operations (dbfn);
frame = Frame (None, -1, "Title", oper)
self.SetTopWindow (frame)
return True
def main ():
dbfn = sys.args[1]
app = Application (redirect=0)
app.MainLoop ()
Apologies if the answer is (or should be) obvious... this
is my first time using wxWindows and I am still rather new
to Python.