我正在尝试检测,选择了哪个选项卡。返回所选选项卡时,“添加”按钮将打开相应的窗口
我有一个单独的函数与if语句,以确保按钮点击将打开相应的窗口。然而,它不像我想要的那样工作
无论选择哪个选项卡,它都会打开3个选项卡中的2个
以下是功能代码:
def tab_add_btn():
if tab_parent.index(active_business):
nieuwe_zaken.business()
if tab_parent.index(noc):
noc_info.add_noc_info()
if tab_parent.index(caller):
Form.add_caller()
应用程序正在从项目中的不同.py文件调用其他窗口
每次我点击按钮时,无论打开哪个选项卡,add\u noc\u info和add\u caller函数都会打开。即使我想打开与打开的选项卡对应的函数
我尝试过几种不同的语句/函数,但都没有成功
# The function which is called by the button
def tab_add_btn():
if tab_parent.index(active_business):
nieuwe_zaken.business()
if tab_parent.index(noc):
noc_info.add_info()
if tab_parent.index(caller):
Form.add_caller()
# The button
add = ttk.Button(main_window, text = "Add", command = tab_add_btn)
add.place(x = 1093, y = 495)
我希望该按钮根据打开/选择的选项卡打开相应的窗口(函数)
如果你们需要更多的代码片段,请告诉我
提前谢谢
找到解决方案:
在生成if语句之前,我首先必须获得tab\u id
相关问题 更多 >
编程相关推荐