I would like to make an item in my ComboBoxText the default value, instead of a blank combo box until the user selects something. Apparently, this is set by changing Active value in Glade to [the item I want to be default]. This does not work.
Here is my code:
#! /usr/bin/env python3
from gi.repository import Gtk
builder = Gtk.Builder()
builder.add_from_file("./personalinfo.ui")
win = builder.get_object("window")
cancel = builder.get_object("cancel")
ok = builder.get_object("ok")
win.set_title("Persona")
win.connect("destroy", Gtk.main_quit)
cancel.connect("clicked", Gtk.main_quit)
ok.connect("clicked", Gtk.main_quit)
win.show_all()
Gtk.main()
Here is the combo box in Glade:
This is actually a bug in Glade. You can manually set this by using:
combo.set_active(int) # 1st item is 0, 2nd is 1, etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With