Passing keywords to methods in tkinter
Jp Calderone
exarkun at intarweb.us
Tue Jan 21 14:57:12 EST 2003
On Tue, Jan 21, 2003 at 01:29:36PM -0600, Stephen Boulet wrote:
> [snip]
>
> class App:
> def __init__(self,parent):
> buttonDict = {'text':'some text', 'fg':'red'}
>
> # problem is here
> MyButton(parent,'1',buttonDict).grid(row=1,column=0)
> MyButton(parent,'2',buttonDict).grid(row=1,column=1)
> MyButton(parent,'3',buttonDict).grid(row=1,column=2)
>
This isn't the right way to pass in keyword args. Try **buttonDict or
using apply() as you used in MyButton, or by passing them explicitly:
MyButton(parent, '1', text='some text', fg='red')
Jp
--
"There is no reason for any individual to have a computer in their
home."
-- Ken Olson, President of DEC, World Future Society
Convention, 1977
--
12:00am up 36 days, 9:48, 4 users, load average: 0.10, 0.14, 0.14
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20030121/131b8b54/attachment.sig>
More information about the Python-list
mailing list