Advertisement
virtualideaz

Simple Login Layout with Button Event

Oct 5th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.72 KB | None | 0 0
  1. from tkinter import *
  2.  
  3. from tkinter import messagebox
  4.  
  5. root = Tk()
  6.  
  7. label1 = Label(root, text="Username : ", relief=FLAT)
  8. label1.place(x=50,y=50)
  9. #another label
  10. label2 = Label(root, text="Password : ", relief=FLAT)
  11. label2.place(x=50,y=80)
  12. #add a text
  13. text1 = Text(root, height=1, width=20)
  14. text1.place(x=150,y=50)
  15. text2 = Text(root, height=1, width=20)
  16. text2.place(x=150,y=80)
  17.  
  18. #add an event to the button
  19. def quitButton():
  20.     root.destroy()
  21. #add a button
  22. Button1 = Button(root, text="OK", height=1, width=5, command = quitButton)
  23. Button1.place(x=150,y=120)
  24. Button2 = Button(root, text="Cancel", height=1, width=5, command = quitButton)
  25. Button2.place(x=250,y=120)
  26.  
  27. root.geometry("400x200")
  28. root.mainloop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement