Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- import tkinter.messagebox
- #tkinter~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- #the username and password
- Username='None'
- Password='None'
- ValidUser=False
- def LoginWindow(sort):
- Tpassword='1234'
- Epassword='4321'
- def show_entry_fields():
- global Username,Password,ValidUser
- User=e1.get()
- Pass=e2.get()
- if sort == 'T':
- if Pass!=Tpassword:
- tkinter.messagebox.showinfo("Warning","Bad Password!")
- ValidUser=False
- else:
- Username,Password=User,Pass
- ValidUser=True
- window.destroy()
- elif sort == 'E':
- if Pass!=Epassword:
- tkinter.messagebox.showinfo("Warning","Bad Password!")
- ValidUser=False
- else:
- Username,Password=User,Pass
- ValidUser=True
- window.destroy()
- window = Tk()
- window.title("Login") #title
- #window.minsize(width=200,height=0) #force window size if needed
- #size and location of window
- #size
- w = 200 # width for the window
- h = 80 # height for the window
- #location
- '''
- #side position
- #x = 625
- #y = 120
- '''
- x=400
- y=300
- # set the dimensions of the screen
- # and where it is placed
- window.geometry('%dx%d+%d+%d' % (w, h, x, y))
- Label(window, text="User Name").grid(row=0)
- Label(window, text="Password").grid(row=1)
- e1 = Entry(window)
- e2 = Entry(window)
- e1.grid(row=0, column=1)
- e2.grid(row=1, column=1)
- Button(window, text='Back', command=window.destroy).grid(row=3, column=0, sticky=W, pady=4)
- Button(window, text='Login', command=show_entry_fields).grid(row=3, column=1, sticky=W, pady=4)
- window.call('wm', 'attributes', '.', '-topmost', '1') #make the window on top of pygame window
- mainloop()
- #-----------------------------------------
- #end of tkinter window
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement