Advertisement
DrAungWinHtut

tk_test.py

Jan 10th, 2024
730
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.94 KB | None | 0 0
  1. from tkinter import *
  2. from tkinter import messagebox
  3.  
  4. def funSayHello():
  5.     print("Hello")
  6.  
  7. def funLogin():
  8.     uname = txtUserName.get()
  9.     password = txtPassword.get()
  10.     if uname == 'aung' and password == '1234':
  11.         messagebox.showinfo('Success!','Login successfully')
  12.     else:
  13.         messagebox.showinfo('Fail!','Login fail, pls try again')
  14.  
  15.  
  16. window = Tk()
  17. window.geometry('340x280')
  18.  
  19. lblUserName = Label(window,text="Username:", font =('Courier',20, 'bold'))
  20. lblUserName.pack(pady = 6)
  21.  
  22. txtUserName = Entry(window, bd =5,width=100,font =('Courier',20, 'bold'))
  23. txtUserName.pack()
  24.  
  25. lblPassword = Label(window,text="Password:", font =('Courier',20, 'bold'))
  26. lblPassword.pack(pady = 6)
  27.  
  28. txtPassword = Entry(window, bd =5,width=100,font =('Courier',20, 'bold'))
  29. txtPassword.pack()
  30.  
  31. btnHello = Button(window, text = 'Login', font =('Courier',20, 'bold'),command=funLogin)
  32. btnHello.pack( pady = 6)
  33.  
  34.  
  35. window.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement