我想创建一个可以在每个窗口上使用的主页按钮,并将我引导回家,使用Python而不使用OOP。
答案 0 :(得分:-3)
这可行:
import Tkinter as tk
win1 = tk.Tk()
win2 = tk.Tk()
win3 = tk.Tk()
win4 = tk.Tk()
def home_button():
print("Home Button Pressed.")
tk.Button(win1, text="home", command=home_button).pack()
tk.Button(win2, text="home", command=home_button).pack()
tk.Button(win3, text="home", command=home_button).pack()
tk.Button(win4, text="home", command=home_button).pack()
win1.mainloop()
win2.mainloop()
win3.mainloop()
win4.mainloop()