Skip to content

Instantly share code, notes, and snippets.

@novel-yet-trivial
Created November 28, 2017 19:41
Show Gist options
  • Save novel-yet-trivial/a354fef60905db5a781de309a45c8740 to your computer and use it in GitHub Desktop.
Save novel-yet-trivial/a354fef60905db5a781de309a45c8740 to your computer and use it in GitHub Desktop.
import tkinter as tk
class menu:
def __init__(self):
self.game = tk.Tk()
self.game.geometry('200x200')
self.var = tk.StringVar()
#~ self.var = tk.StringVar(master=self.game) # this solves the problem
ent = tk.OptionMenu(self.game, self.var, 'one', 'two', 'three', 'four')
ent.pack()
lbl = tk.Label(self.game, textvariable=self.var)
lbl.pack()
btn = tk.Button(self.game, text="new window", command=self.playagain)
btn.pack()
self.game.mainloop()
def playagain(self):
menu()
menu()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment