Introduction: python import tkinter as tk root = tk.Tk() root.mainloop() python import tkinter as tk root = tk.Tk() label = tk.Label(root, text="Hello, Tkinter!") label.pack() root.mainloop() python import tkinter as tk root = tk.Tk() def button_click(): print("Button clicked!") button = tk.Button(root, text="Click me", command=button_click) button.pack() root.mainloop() python import tkinter as tk from tkinter import messagebox root = tk.Tk() def show_message(): messagebox.showinfo("Message", "This is a message box!") button = tk.Button(root, text="Show Message", command=show_message) button.pack() root.mainloop()


上一篇:
下一篇:
切换中文