import pygtk
import gtk
import gobject
def window_delete_event(*args):
return False
def window_destroy(*args):
gtk.main_quit()
if __name__ == '__main__':
win = gtk.Window()
# combo's model
model = gtk.ListStore(gobject.TYPE_STRING)
for n in xrange(100):
model.append([str(n)])
# combo
combo = gtk.ComboBoxEntry(model)
win.add(combo)
# combo's style
style = gtk.rc_parse_string('''
style "my-style" { GtkComboBox::appears-as-list = 1 }
widget "*.mycombo" style "my-style"
''')
combo.set_name('mycombo')
combo.set_style(style)
win.show_all()
win.connect('delete-event', window_delete_event)
win.connect('destroy', window_destroy)
gtk.main()
mtasic
2009-05-17 12:06:32