Python Forum

Full Version: user name and password GUI works (almost)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This user name and password code works if I comment out this line:

top.title("User Credentials")
I've tried to find where I went wrong with the syntax, but I'm coming up empty.  The rest of the code runs fine.  It also would be nice if I could make this form non-resizable.  

from tkinter import *
root = Tk()
top.title("User Credentials")
Label(root, text="Username").grid(row=0, sticky=W)
Label(root, text="Password").grid(row=1, sticky=W)
Label(root, text="(Enter user name and password)").grid(row=2, sticky=W)
Entry(root).grid(row=0, column=1, sticky=E)
Entry(root).grid(row=1, column=1, sticky=E)
Button(root, text="Login").grid(row=2, column=1, sticky=E)
root.mainloop()
You haven't defined top but have created root.
It will work if you use
root.title("User Credentials")
or you could change all instances of root to top.
That fixed the problem.  Thanks a ton for your help.
No problem, I'm learning myself and will probably be posting here many times for help.