选择一个选项后,wxpython组合框阻止用户选择其他选项

时间:2013-11-07 05:28:58

标签: python

我想锁定组合框,这会阻止用户在输入开始按钮后选择任何其他内容。

这是因为我在界面上进行监控。组合框有接口名称列表。一旦启动显示器,我不希望用户在停止之前选择其他接口卡。

无论如何都要去做吗?

selectedInterface = self.interfaces_cblist.GetValue()
        self.selectInterfaceStr = str(selectedInterface)    
        if len(selectedInterface) == 0:
            noSelect_error = wx.MessageDialog(None,"Please select an interface","",wx.OK|wx.ICON_ERROR)
            noSelect_error.ShowModal()
        else:       
            monitorStarted = wx.MessageDialog(None,"Monitor on %s started"%self.selectInterfaceStr,"",wx.OK|wx.ICON_ERROR)
            monitorStarted.ShowModal()
            self.monitorInterface_button.Disable()
            self.abortValue = 1;
            self.camDetect = multiprocessing.Process(target=self.camtableDetection,args=(self.selectInterfaceStr,))
            self.dhcpDetect = multiprocessing.Process(target=self.dhcpexhaustion,args=(self.selectInterfaceStr,))
            self.camDetect.start()
            self.dhcpDetect.start()

1 个答案:

答案 0 :(得分:0)

如果要禁用组合框,您应该可以执行以下操作:

self.interfaces_cblist.Enable(False)

(假设interfaces_cblist是你想要禁用的组合框......)