我有一个 pyqtgraph Combobox,其定义如下。
def __init__(self):
# some other stuff....
mylist=OrderedDict()
mylist['1k'] = 1
mylist['10k'] = 10
mylist['100k'] = 100
mylist['1M'] = 1000
self.myselectorA = ComboBox()
self.myselectorA.setItems(mylist)
self.myselectorA.currentIndexChanged.connect(self.selchangedA)
def selchangedA(self):
self.sq.setA(self.myselectorA.value())
if self.sq.gainlink:
self.sq.setB(100./self.myselectorA.value())
self.viewupdate = True
self.myselectorB.setValue(100./self.myselectorA.value())
self.viewupdate = False
附加的回调函数selchangedA
做了一些事情,其中包括第二个 Combobox ( myselectorB
) 的可选更新。此更新取决于另一个变量gainlink
。
我有一种情况,我需要能够检测到组合框中相同元素的重新选择,以便它更新辅助组合框。这可能吗?
我知道用户应该只在辅助组合框上选择适当的值,但我希望为用户提供最大的灵活性。