I've been experimenting with the Notebook component and love it. One problem
though is I can't figure out how to pass a parameter to one of my Notebook
pages. For example, in the below example I'm loading teste.py into two
notebook pages. Is there some way to pass a paramter to it, as if I were
typing on the commandline "teste.py whatever"? In other words, to pass the
word "whatever" to teste.py?
Here's a zip containing all the files necessary to run this test:
http://remindmyass.com/simplenotebook.zip
And here's the simple code in simplenotebook.py contained in that zip file:
#!/usr/bin/python
import os, sys
import wx
from PythonCard import model
class simpleNotebook(model.Background):
def on_initialize(self, event):
self.components.notebook.SetMinSize(self.components.notebook.size)
import teste
win1 = model.childWindow(self.components.notebook, teste.MyApp) #
how to pass a parameter to this?
self.components.notebook.AddPage(win1, 'teste', True)
win2 = model.childWindow(self.components.notebook, teste.MyApp) #
how to pass a parameter to this?
self.components.notebook.AddPage(win2, 'teste2', True)
if __name__ == '__main__':
app = model.Application(simpleNotebook)
app.MainLoop()
|