Problem w/ Tkinter
Matt McCredie
mccredie at gmail.com
Fri Aug 24 17:32:52 EDT 2007
> text="Action?",command=self.V(a,b,c,d)).pack(anchor=W) doesn't even do
> anything, what can I do to fix this problem?
I see many mistakes.
First: `command=self.V(a,b,c,d)' is actually calling self.V. You don't
want to call self.V, which will assing `command' to the return value,
you want to pass self.V itself.
Also, here:
[code]
a = Radiobutton(choices, text="Add News", variable=v,value=1).pack(anchor=W)
...
[/code]
You are assigning a, b, c and d to the return value of `pack' which is
None. You do the same thing with the Button.
Also, V (well, callbacks in general) can't take any parameters.
V is checking a,b,c and d which, if done correctly, would be instances
of Radiobutton. Directly comparing them against an empty string won't
work.
How to fix your code?
Read this: http://docs.python.org/tut/
Then this: http://www.pythonware.com/library/tkinter/introduction/
Also, this might help: http://www.python.org/dev/peps/pep-0008/
Matt
More information about the Python-list
mailing list