Skip to content Skip to sidebar Skip to footer

Pyqt4 Combobox Changes The List Of Another Combobox

I just started using pyqt4 and am stuck on how to change a combobox list from another combobox. Is there a example of sometype that shows how to work this method. Do I use a if, el

Solution 1:

What you want to do is something like this:

def __init__(self):
    ...
    self.items = {'1':['a','b','c'],'2':['d','e','f'],'3':['g','h','i']}
    self.Combobox_1.activated[str].connect(self.on_combo_activated)
    ...

...

def on_combo_activated(self, text):
    self.Combobox_2.clear()
    self.Combobox_2.addItems(self.items[text])

Post a Comment for "Pyqt4 Combobox Changes The List Of Another Combobox"