[問題] 新手發問 跨檔案操作UI問題

作者: terryone (???)   2017-10-27 16:25:38
大家好 我是Python新手 有需要的時候拿來做個小tool這樣的程度
現在需要做一個比較大型的AP 需要有UI
我用的環境如下
Python3.5 IDE:Pycharm UI用tkcon生成
有2個檔案
test.py
test_Support.py
test.py裡面描述所有UI的部分 包含List Text label Button等
root = Tk()
test_support.set_Tk_var()
top = New_Toplevel_1(root)
test_support.init(root, top)
root.mainloop()
class New_Toplevel_1:
def __init__(self, top=None):
self.Text1 = Text(top)
self.Text1.place(relx=0.0, rely=0.54, relheight=0.36, relwidth=1.0)
self.Text1.configure(background="white")
大概像是這樣的內容 Text1要顯示log訊息
我要在test_Support.py中做邏輯操作再把訊息打在Text1上
可是我不知道該如何做
有試過test.Text1.insert(), self.Text1.insert等
都報錯 不存在的變數 未定義之類的
請各位版友知道的不吝指導 感恩
作者: uranusjr (←這人是超級笨蛋)   2017-10-28 05:28:00
test.top.Text1.insert() 錯誤訊息明明有寫什麼沒定義吧

Links booklink

Contact Us: admin [ a t ] ucptt.com