wxPython and macros (was: Why don't people like lisp?
Anthony Briggs
abriggs at westnet.com.au
Mon Oct 27 07:16:43 EST 2003
At 3:10 AM -0800 27/10/03, Tayss wrote:
>mike420 at ziplip.com wrote:
>> Why do you need a macro for that? Why don't you just write
>>
> > def start_window(name) : # 1
> > app = wxPySimpleApp() # 2
> > frame = MainWindow(None, -1, name) # 3
>> frame.Show(True) # 4
>> app.MainLoop() # 5
> > return (app, frame) # 6
>
>Notice in #1, you used a string ("name") as the parameter. But that's
>weird, you'd rather have all of line #3 as the param, not just the
>little string part of it. So why can't you do that?
Why don't you do something like this?
def start_window(appfunction, framefunction) : # 1
exec("app = "+appfunction) # 2
exec("frame = "+framefunction) # 3
frame.Show(True) # 4
app.MainLoop() # 5
return (app, frame) # 6
start_window( "wxPySimpleApp()", "MainWindow(None, -1, name)") # 7
Anthony
--
----------------------------------------------------
HyPEraCtiVE? HeY, WhO aRE YoU cALliNg HypERaCtIve?!
aBRiGgS at wEStNeT.cOm.aU
----------------------------------------------------
More information about the Python-list
mailing list