123456789101112131415161718 |
- import tkinter as tk
-
- def button_callback():
- print("Button was clicked")
-
- # Create the main window
- window = tk.Tk()
-
- # Add a label to the window
- label = tk.Label(text="Hello, World!")
- label.pack()
-
- # Add a button to the window
- button = tk.Button(text="Click me!", command=button_callback)
- button.pack()
-
- # Run the main loop to display the window
- window.mainloop()
|