how to create multiple windows in tkinter with button

Solutions on MaxInterview for how to create multiple windows in tkinter with button by the best coders in the world

showing results for - "how to create multiple windows in tkinter with button"
Lea
21 May 2020
1#import module needed
2import tkinter as tk
3#write the new window function which
4#will be called when button pressed
5def new_window():
6    window = tk.Toplevel(root)
7    canvas = tk.Canvas(window, height=HEIGHT, width=WIDTH)
8    canvas.pack()
9
10HEIGHT = 400
11WIDTH = 300
12#create original window (title not need but why not?)
13root = tk.Tk()
14root.title("new window making machine: ")
15canvas = tk.Canvas(root, height=HEIGHT, width=WIDTH)
16canvas.pack()
17#create button that will be placed
18button = tk.Button(root, text="new window", bg='black', fg='#469A00',
19                              command=lambda: new_window())
20#can use .grid() or .place() instead of pack .place()
21#is the best according to me if you want the most control of positions
22button.pack()
23root.mainloop()
queries leading to this page
how to mainloop two separate windows in tkinterpython tkinter open multiple windowscreate two windows in tkintertwo windows in tkinterhow to make more than one tkinter windowtkinter multiple buttonstkinter two windows appearhow to create multiple windows in tkintermultiple windows tkinterhow to create multiple windows in tkinter with buttontwo windows tkinterhow to have multiple windows in tkinter at the same timemanaging multiple windows on tkintermulti window programm using tkintermulti windows tkinterhow to link two windows in tkintercreate tkinter app that has multiple windowstkinter generating two windowsadd key board binding to tkinter guiplace multiple window button in python tkintertkinter open multiple windowshow to have multiple windows in tkintercreate button in multiple windows tkinterdefine multiple windows in python tkintermultiple button tkintertkinter i have two windows in same timehow to implement multiple api on single screen in react nativetkinter multiple windows pythonhow to create multiple windows in python tkintertkinter multiple windows classesstop tkinter from generating two windowsmultiple windows in tkintertkinter window with two buttonscreate two windows tkinteropen multiple tkinter windows in one programtkinter multiple windowsmultiple tkinter windowsmultiple winow in tkinterhow to open multiple tkinter windowstkinter have multiple windowsmultiple forms tkinter pythonhow to use multiple windows in tkinterhow to create more than one window using tkinter 3fhow to open multiple windows in tkintertkinter in have two windows in same timetkinter 22 class 22tkinter create multiple buttonstkinter multiple windowpython gui multiple windowshow to create multiple windows in tkinter with buttonstkinter example code for multiple windowshow to make create multiple windows in tkintertkinter create multiple windowsusing two tkinter windowshow to make more window on tkinterpython tkinter app multiple windowspython create ultiple windowsmake multiple button in tkinertkinter show multiple canvas in the timehow to connect two windows to one window in tkintercreating multiple windows in tkinterusing tkinter can we add multiple windowscreate multiple windows and work on it tkintertkinter application with multiple windowscan tkinter have multiple windows open 3fhow to make multiple windows in tkintertkinter run multiple windowshow to create multiple tkinter windowshow to create multiple windows tkinterhow to install two buttons in window tkintertkinter make multiple windowscreate multiple windows tkintermultiple windows in python tkinterpython tkinter multiple windowsgui python how to connect two windowsmultiple windows with tkintercreate multiple windows with tkinter in pythonhow to create multiple windows in tkinter with button