Дело не в количестве поддерживаемых окон, просто gui-редактор не спроектирован в моей голове! import tkinter as tk from tkinter import ttk
def open_new_window(): # Create a Toplevel window new_window = tk.Toplevel(root) new_window.title("New Window") new_window.geometry("300x200")
# Add widgets to the new window ttk.Label(new_window, text="This is the new window!").pack(pady=10) ttk.Button(new_window, text="Close", command=new_window.destroy).pack(pady=10) def else_open_new_window(): # Create a Toplevel window new_window = tk.Toplevel(root) new_window.title("New Window") new_window.geometry("300x200")
# Add widgets to the new window ttk.Label(new_window, text="здесь некоторый текст").pack(pady=10) ttk.Button(new_window, text="Close", command=new_window.destroy).pack(pady=10)
# Create the main window root = tk.Tk() root.title("Main Window") root.geometry("400x300")
# Add a button to the main window to open the new window main_label = ttk.Label(root, text="This is the main window.") main_label.pack(pady=10)
new_window_button = ttk.Button(root, text="Open New Window", command=open_new_window) new_window_button.pack(pady=10) new_window_button = ttk.Button(root, text="Open Second Window", command=else_open_new_window) new_window_button.pack(pady=10)
# Start the Tkinter event loop root.mainloop()
|