1

これがケースです: 複数の gtk.VBox() を gtk.ComboBox に追加したいです。まだそれを行う方法を見つけていませんが、かなり長い間検索しました。

前もって感謝します

編集:これで到達したい主なことは、ComboBox 内のテキスト以外に画像を取得することです。ありがとうございました。

4

1 に答える 1

1

TreeView の場合と同様に、CellRendererPixbuf を ComboBox に追加できます。

model = gtk.ListStore(gtk.gdk.Pixbuf, str)
model.append([gtk.gdk.pixbuf_new_from_file('image.png'), 'Foo'])

cb = gtk.ComboBox(model)

pb_cell = gtk.CellRendererPixbuf()
cb.pack_start(pb_cell, False)
cb.add_attribute(pb_cell, 'pixbuf', 0)

txt_cell = gtk.CellRendererText()
cb.pack_start(txt_cell, True)
cb.add_attribute(txt_cell, 'text', 1)
于 2012-09-23T15:40:47.057 に答える