Advertisement
Osiris1002

Tkinter

Feb 18th, 2024
837
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.69 KB | None | 0 0
  1. import tkinter as Tkinter
  2. def println():
  3.     x = inputBox.get()
  4.     #Replace current label into new label
  5.     label["text"] = x
  6.     label.pack()
  7.  
  8. def bye():
  9.     #Close the window
  10.     window.destroy()
  11.  
  12. #create window
  13. window = Tkinter.Tk()
  14. window.title("Тестов прозорец")
  15.  
  16. #create a button
  17. button1 = Tkinter.Button(window,text="Button1",command=println)
  18. button1.pack()
  19.  
  20. button2 = Tkinter.Button(window,text="Button2",command=bye)
  21. button2.pack()
  22.  
  23. #Create a line of text
  24. label = Tkinter.Label(window,text="Press this button to be suprised.")
  25. label.pack()
  26.  
  27. #Create an input box
  28. inputBox = Tkinter.Entry(window)
  29. inputBox.pack()
  30.  
  31. #Show the window
  32. window.mainloop()
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement