Search code examples
pythonpython-2.7gtk3pygobject

Create combo box in python GTK 3.0 where the input of the first box changes the possible input choices for the second box


I am looking to create a combo box in GTK where the user selected choice in the first box changes the choices available in the next boxes; ie if the first box contained manufacturers names, the next box would contain products of that manufacture, furthering that example if I selected bmw I could only select cars made by bmw. I know what the basic structure should look like, however I am not sure how to have the signals trigger one another. If someone could provide basic code or pseudo code that would be perfect .


Solution

  • The easiest solution would be to have one manufacturer model and many product models. When manufacturer is changed, combobox will emit "changed" signal. In it's handler you can set appropriate model to the second combobox using set_model() method.