Tkinter button bind

Posted by rejinacm on Stack Overflow See other posts from Stack Overflow or by rejinacm
Published on 2009-07-20T08:51:50Z Indexed on 2010/05/31 20:03 UTC
Read the original article Hit count: 364

Filed under:
|
|

Hello,

Help urgently..

This is my code:

import Tkinter
from Tkconstants import *

tk = Tkinter.Tk()


class MyApp:

    def __init__(self,parent):

        self.frame = Tkinter.Frame(tk,relief=RIDGE,borderwidth=2)
        self.frame.pack()

        self.message = Tkinter.Message(tk,text="Symbol Disolay")

        label=Tkinter.Label(self.frame,text="Is Symbol Displayed")
        label.pack()

        self.button1=Tkinter.Button(self.frame,text="YES")
        self.button1.pack(side=BOTTOM)
        self.button1.bind("<Button-1>", self.button1Click)

        self.button2=Tkinter.Button(self.frame,text="NO")
        self.button2.pack()
        self.button2.bind("<Button-1>", self.button2Click)


    def button1Click(self, event):
            "pressed yes"

    def button2Click(self, event):
            "pressed no"

myapp = MyApp(tk)
tk.mainloop()

What shall i do in button1Click() and button2Click() so that they return "YES" or "NO" to my program in string format ???

© Stack Overflow or respective owner

Related posts about bind

Related posts about tkinter