我已经创建了2个脚本。
1。rec.py
使用tkinter
输入用户输入
2。classify.py
使用来自rec.py
的输入来执行转换
我想要实现的目标:
从rec.py
调用用户输入,并使其在classify.py
中成为变量
使用变量在classify.py
打印classify.py
的输出
我做了什么:
rec.py
:
def click(text_user_example):
text_user = text_user_example
os.system("classify.py")
#create a text entry box
text_user = Entry(window, width=20, bg="white")
text_user.grid(row=2, column=0, sticky=W)
#add a submit button
Button(window, text="SUBMIT", width=6, command = lambda:
click(text_user)).grid(row=3, column=0, sticky=W)
classify.py
:
from rec import text_user #this is the only variable i want from "rec.py"
--other tranformations using text_user
print(text_user)
不幸的是,每次我运行classify.py
时,tkinter
界面都会弹出,即使我已经提交了输入也是如此(输入文本用户后该界面不应弹出)。
我在做什么错了?