Generally you would pass in anything needed:
#file 'a'
class Root:
def __init__(self):
self.root = root()
self.root.title('Hello')
self.b = None
def boo(self):
import b
self.b = b.A(self.root) # pass the root object in
self.b.__a_meth__() # don't forget to call this if you want to see anything
Root.boo()
#file 'b'
class A:
def __init__(self, root):
self.root = root
self.frame = tk.LabelFrame(self.root)
self.frame.pack()
def __a_meth__(self):
Button(self.frame, text = 'YES')
Button.pack()
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…