[Tutor] binding a button to an entry
ADRIAN KELLY
kellyadrian at hotmail.com
Tue May 1 16:40:27 CEST 2012
Hi all, Please can anyone tell me how i bind the activation of a button with input from an entry widget. i know i should be using classes etc. but i don't understand them fully yet.. problem here is that no matter what i enter in the entry window it displays as password incorrect.
from Tkinter import *
password="trial"
def reveal(): """Display message based on password""" contents=s if contents=="trial": print "password correct" else: print "password wrong"
#mainroot=Tk()root.title("Password entry box")root.geometry("300x100")app=Frame(root)app.grid()
#labelslbl=Label(app, text="Enter your password: ")lbl.grid(row=1, column=0)
#create entry widgetse = Entry(root)e.grid(row=1, column=1)s=e.get()
#create a submit buttonb=Button(root, text="SUBMIT", command=reveal)b.grid(row=0, column=2)
root.mainloop()
thanks all,adrian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120501/b1d8ff70/attachment.html>
More information about the Tutor
mailing list