如何使用new_with_area接口创建Gtk组合框?

时间:2015-03-21 08:45:53

标签: gtk pygtk gtk3 gtk# gtkmm

根据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相关的任何内容。

使用的语言并不重要。

1 个答案:

答案 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)并做你需要做的任何事情。

相关问题