Problem w/ Tkinter

Lamonte Harris pyth0nc0d3r at gmail.com
Fri Aug 24 23:00:35 CEST 2007


How do I add a command to a button say for instance
class MYCLASNAME:
    def choices(self):
        choices = Toplevel()
        v = IntVar()
        a = Radiobutton(choices, text="Add News",
variable=v,value=1).pack(anchor=W)
        b = Radiobutton(choices, text="Edit News",
variable=v,value=2).pack(anchor=W)
        c = Radiobutton(choices, text="Delete News",
variable=v,value=3).pack(anchor=W)
        d = Radiobutton(choices, text="Quit",
variable=v,value=4).pack(anchor=W)
        button = Button(choices, text="Action?",command=self.V
(a,b,c,d)).pack(anchor=W)
        choices.title("What are your actions?")
    def V(self,a,b,c,d):
        if a != "":
            print a
        elif b != "":
            print b
        elif c != "":
            print c
        elif d != "":
            print d
        else:
            print "error";
button = Button(choices, 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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070824/7e6d58f7/attachment.html>


More information about the Python-list mailing list