根据gtk文档,您可以创建一个组合框:
GtkWidget * gtk_combo_box_new ()
GtkWidget * gtk_combo_box_new_with_entry ()
GtkWidget * gtk_combo_box_new_with_model ()
GtkWidget * gtk_combo_box_new_with_model_and_entry ()
GtkWidget * gtk_combo_box_new_with_area ()
GtkWidget * gtk_combo_box_new_with_area_and_entry ()
我找到了gtk_combo_box_new_with_model
的很多示例,但我找不到与使用gtk_combo_box_new_with_area
相关的任何内容。
使用的语言并不重要。
答案 0 :(得分:1)
类似(pygobject):
from gi.repository import Gtk
area = Gtk.CellAreaBox()
combo = Gtk.ComboBox.new_with_area(area=area)
cell = Gtk.CellRendererText()
area.pack_start(cell, True, True, True)
你可以在盒子里添加更多的CellRenderers(这是一个Gtk.Box)并做你需要做的任何事情。