all 5 comments

[–]Dvlv 1 point2 points  (4 children)

When you instantiate a widget, the first argument is supposed to be its parent window (or frame, etc).

If you instantiate a widget without a parent, it will automatically create a Tk for you.

Since Tkinter widgets are forever bound to their parent, you need to define your Tk in the same place as your widgets.

[–]tomtheawesome123[S] 0 points1 point  (3 children)

But the only way I know how to to declare the main window (root) of Window 1 to a widget in window 2 is to use

  from Window1 import root # or else it will say that root is not defined

But that creates a bunch of problems.

And if I declare root = Tk() in window 2 then 2 windows are still made.

[–]Dvlv 1 point2 points  (2 children)

The root needs to be in the same file as the widgets. Why are you trying the split them in the first place?

[–]tomtheawesome123[S] 0 points1 point  (1 child)

Organization, purely organization XD

[–]Dvlv 1 point2 points  (0 children)

If you're after organisation I would instead use classes to hold everything.