Skip to content

Instantly share code, notes, and snippets.

@secemp9
Created November 22, 2022 22:22
Show Gist options
  • Save secemp9/70e0214f1e0e712a1ce03cb491efe002 to your computer and use it in GitHub Desktop.
Save secemp9/70e0214f1e0e712a1ce03cb491efe002 to your computer and use it in GitHub Desktop.
tkinter playground v1
import tkinter as tk
container = []
def destroy_window(x):
x.destroy()
def full_window(x):
x.state("zoomed")
def hide(x):
x.withdraw()
def gui1():
root1 = tk.Tk()
container.append(root1)
def gui2():
root2 = tk.Tk()
container.append(root2)
def tools(wow1, wow2):
tk.Button(wow1, text='Destroy', bd='5',
command=lambda: destroy_window(wow2)).pack()
tk.Button(wow1, text='Full window', bd='5',
command=lambda: full_window(wow2)).pack()
tk.Button(wow1, text='Hide', bd='5',
command=lambda: hide(wow2)).pack()
gui2()
gui1()
tools(container[0], container[1])
container[0].attributes("-topmost", True)
print(container)
container[
0].mainloop() # https://stackoverflow.com/questions/48045401/why-are-multiple-instances-of-tk-discouraged/69062053#69062053
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment