Advertisement
go6odn28

tk

Feb 18th, 2024
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | None | 0 0
  1. from tkinter import *
  2. root = Tk()
  3.  
  4.  
  5. def refresh_window():
  6.     # Redraw the window
  7.     window.update()
  8.     window.update_idletasks()
  9.     print("Refresh completed.")
  10.  
  11.  
  12. # Create the main window
  13. window = root
  14. window.geometry("300x300")
  15. window.title("PythonExamples.org")
  16.  
  17. label = Label(window, text="Click the below button to refresh the window.")
  18. label.pack()
  19.  
  20. button = Button(window, text="Refresh", command=refresh_window)
  21. button.pack()
  22.  
  23. root.mainloop()
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement