TheEggSample
TheEggSample

Reputation: 343

GTK3 combobox without entry moving to after GTK3 combobox with entry. Why?

So, I've been developing this application for work, that essentially allows the user to select their department, building, and floor. This brings up a floor plan of the selected location, where they can select different printers on that floor plan. It also brings up another combobox where they can select by name, the printer. I've created the comboboxes in order of how I want them to display: Department, Building, Floor, Printer. They don't display that way though. This is how they display instead: ComboBox Order. I'm guessing this is because the Floor combobox is a Gtk.ComboBoxText object, instead of just Gtk.ComboBox like the rest of them. Is there a way to fix this or work around it?

    # Department Combo
    self.department_combo = Gtk.ComboBox.new_with_model_and_entry(self.logic.get_department_store())
    self.department_combo.set_entry_text_column(0)
    self.combo_rowbox.pack_start(self.department_combo, False, False, 0)
    self.department_combo.show()
    # Building Combo
    self.building_combo = Gtk.ComboBox.new_with_entry()
    self.building_combo.set_entry_text_column(0)
    self.combo_rowbox.pack_start(self.building_combo, False, False, 0)
    self.building_combo.hide()
    # Floor Combo
    self.floor_combo = Gtk.ComboBoxText()
    self.floor_combo.set_entry_text_column(0)
    self.combo_rowbox.pack_start(self.floor_combo, False, False, 0)
    self.floor_combo.hide()
    # Printer Combo
    self.printer_combo = Gtk.ComboBox.new_with_entry()
    self.printer_combo.set_entry_text_column(0)
    self.combo_rowbox.pack_start(self.printer_combo, True, True, 0)
    self.printer_combo.hide()

Upvotes: 1

Views: 161

Answers (1)

B8vrede
B8vrede

Reputation: 4532

Assuming self.combo_rowbox is Gtk.Box I would suggest changing the pack_start used for self.printer_combo to pack_end. This means that the widget is added on the right side of the Box instead of the left side.

Alternatively you could also try using a Gtk.Grid as the container for your ComboBox's it is less flexible but helps to get a more predictable result.

Upvotes: 1

Related Questions