Reputation: 305
I am currently trying to create two windows with a tkinter program but it doesn't seem to be working. It was only recently that i just moved over my game to tkinter and it is the first time working with tkinter. Due to that I have no clue why this isn't working.
This is my first window and its working fine
class Application(tk.Frame):
def __init__(self, master=None):
super().__init__(master)
self.pack()
self.create_widgets()
self.crafting_listbox
My second window though isn't working
class Application_2(tk.Frame):
def __init__(self, master=None):
super().__init__(master)
self.pack()
self.crafting_listbox()
Then the finishing bit
root = tk.Tk()
app = Application(master=root)
app.mainloop()
I am unsure why this isn't working, whats going wrong?
Upvotes: 3
Views: 4233
Reputation: 13729
You never call your second Frame.
To make a second window use the Toplevel
class.
root = tk.Tk()
app = Application(master=root)
second_win = tk.Toplevel(root)
app2 = Application_2(second_win)
root.mainloop()
Upvotes: 5