Let's say I have 3 files -
- main.py
- CommunicationsHandler.py
- main_canvas.py
Contents of main.py
# Showing only main part
from CommunicationsHandler import CommunicationsHandler
def replace_window(event):
root.geometry('+0+0')
l.bind('<ButtonRelease-1>', replace_window)
CommunicationsHandler.root = root
import main_canvas
from main_canvas import *
# root = CommunicationsHandler.root
Contents of main_canvas.py
# Showing only main part
from CommunicationsHandler import CommunicationsHandler
# I had to keep this name to root as I created main.py later
root = tk.Toplevel(CommunicationsHandler.root)
CommunicationsHandler.child = root
Contents of CommunicationsHandler
# Showing only main part
class CommunicationsHandler:
root = None
child = None
Now when <ButtonRelease-1>
binding is fired in main.py
, it doesn't change the geometry of GUI of main.py
rather it changes the GUI of main_canvas.py
how is this possible? I solved the problem by uncommenting the last line of main.py
but still is it automatically changing its root or what?