Python Forum
Why is this opening 2 windows/frames?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Why is this opening 2 windows/frames?
#1
from tkinter import *

class App(Tk):

    def __init__(self, root):

        Tk.__init__(self)

        self.geometry("1280x720")

        MainFrame = Frame(self, width=30, height=40, bg='blue')
        SecFrame = Frame(self, width=30, height=40, bg='red')
        MainFrame.grid(row=0, column=2)
        SecFrame.grid(row=1, column=2)

self = Tk()
App = App(self)
self.mainloop()
Very basic structure, but with something so basic, I cannot figure out why it continues to open 2 windows.

Solved it.
self = Tk()
App = App(self)
self.mainloop()
Needed to be changed to:
App = App()
App.mainloop()
to simplify further:
App().mainloop()
Reply


Messages In This Thread
Why is this opening 2 windows/frames? - by WuchaDoin - Oct-17-2018, 06:55 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020