Tkinter/Pmw callback question

David Lees debl at NoNOSpamtheworld.com
Sun Feb 25 16:24:11 EST 2001


I am trying to learn Tkinter and Pmw and am modifying demo Pmw code
(EntryField.py).  I want to call a Python function that I have defined
when I push a button and am having problems with the callback.  As long
as the function has no arguments all is well, but I am unable to do a
callback on a function that has arguments.  For example this works:

    RunButton = Tkinter.Button(root, text = 'Run',command=foo)

where foo has no arguments, but when I write:

    RunButton = Tkinter.Button(root, text = 'Run',command=barf('junk'))

things do not work correctly.  The 'barf' function seems to execute when
the program starts up, but not when I click the Run button.

What goes on here and what is the correct way to do call backs?

Thanks,

david lees
debl at theworld.com



More information about the Python-list mailing list