Python Forum
user name and password GUI works (almost)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
user name and password GUI works (almost)
#1
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()
Reply
#2
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.
Reply
#3
That fixed the problem.  Thanks a ton for your help.
Reply
#4
No problem, I'm learning myself and will probably be posting here many times for help.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020