[Tutor] binding a button to an entry
d at davea.name
Tue May 1 16:51:26 CEST 2012
On 05/01/2012 10:40 AM, ADRIAN KELLY wrote:
> 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 *
> 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)
> thanks all,adrian
Please post as text; this program is incomprehensible as viewed in
More information about the Tutor