本文整理汇总了Python中gtk.combo_box_new_text方法的典型用法代码示例。如果您正苦于以下问题:Python gtk.combo_box_new_text方法的具体用法?Python gtk.combo_box_new_text怎么用?Python gtk.combo_box_new_text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gtk
的用法示例。
在下文中一共展示了gtk.combo_box_new_text方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createComboBox
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import combo_box_new_text [as 别名]
def createComboBox(parent, choices=["null"], active=0, gridX=0, gridY=0, sizeX=1, sizeY=1, xExpand=True, yExpand=True, handler=None):
"""Creates a combo box with text choices and adds it to a parent widget."""
temp = gtk.combo_box_new_text()
for choice in choices:
temp.append_text(choice)
temp.set_active(active)
if handler != None:
temp.connect("changed", handler)
parent.attach(temp, gridX, gridX+sizeX, gridY, gridY+sizeY, xoptions=gtk.EXPAND if xExpand else 0, yoptions=gtk.EXPAND if yExpand else 0)
return temp
示例2: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import combo_box_new_text [as 别名]
def __init__(self, canvas):
self.canvas = canvas
vw_layout.LayoutWindow.__init__(self)
self.vbox = gtk.VBox()
elabel = gtk.Label(" Memory Expression ")
slabel = gtk.Label(" Memory Size ")
self.eentry = gtk.Entry()
self.sentry = gtk.Entry()
self.sentry.set_text("256")
self.nextbutton = gtk.Button()
i = gtk.image_new_from_stock(gtk.STOCK_GO_FORWARD, gtk.ICON_SIZE_BUTTON)
self.nextbutton.set_image(i)
self.nextbutton.connect("clicked", self.goforward)
self.backbutton = gtk.Button()
i = gtk.image_new_from_stock(gtk.STOCK_GO_BACK, gtk.ICON_SIZE_BUTTON)
self.backbutton.set_image(i)
self.backbutton.connect("clicked", self.goback)
self.downbutton = gtk.Button()
i = gtk.image_new_from_stock(gtk.STOCK_GO_DOWN, gtk.ICON_SIZE_BUTTON)
self.downbutton.set_image(i)
self.downbutton.connect("clicked", self.godown)
self.upbutton = gtk.Button()
i = gtk.image_new_from_stock(gtk.STOCK_GO_UP, gtk.ICON_SIZE_BUTTON)
self.upbutton.set_image(i)
self.upbutton.connect("clicked", self.goup)
hbox = gtk.HBox()
hbox.pack_start(self.backbutton, expand=False)
hbox.pack_start(self.nextbutton, expand=False)
hbox.pack_start(self.upbutton, expand=False)
hbox.pack_start(self.downbutton, expand=False)
hbox.pack_start(elabel, expand=False)
hbox.pack_start(self.eentry, expand=True)
hbox.pack_start(slabel, expand=False)
hbox.pack_start(self.sentry, expand=True)
self.cbox = gtk.combo_box_new_text()
for name in self.canvas.getRendererNames():
self.canvas.addRenderer(name, self.canvas.getRenderer(name))
self.cbox.append_text(name)
self.cbox.set_active(0)
hbox.pack_start(self.cbox, expand=False)
self.vbox.pack_start(hbox, expand=False)
self.vbox.pack_start(self.canvas, expand=True)
self.add(self.vbox)
self.eentry.connect("activate", self.entryActivated)
self.sentry.connect("activate", self.entryActivated)
self.cbox.connect("changed", self.updateMemoryView)
self.canvas.memwin = self
self.updateHistoryButtons()
示例3: __init__
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import combo_box_new_text [as 别名]
def __init__(self, constraint=None, data=None, **kwargs):
super().__init__(homogeneous=False, spacing=self._COMBO_BOX_SPACING, **kwargs)
self._displayed_item_combo_box = None
self._layer_combo_box = gimpui.LayerComboBox(constraint=constraint, data=data)
self._channel_combo_box = gimpui.ChannelComboBox(constraint=constraint, data=data)
self._vectors_combo_box = gimpui.VectorsComboBox(constraint=constraint, data=data)
self._item_combo_boxes = [
self._GimpItemComboBox(
_("Layer"),
self._layer_combo_box,
self._layer_combo_box.get_active_layer,
self._layer_combo_box.set_active_layer,
gimp.Layer),
self._GimpItemComboBox(
_("Channel"),
self._channel_combo_box,
self._channel_combo_box.get_active_channel,
self._channel_combo_box.set_active_channel,
gimp.Channel),
self._GimpItemComboBox(
_("Vectors"),
self._vectors_combo_box,
self._vectors_combo_box.get_active_vectors,
self._vectors_combo_box.set_active_vectors,
gimp.Vectors)]
self._item_types_combo_box = gtk.combo_box_new_text()
self.pack_start(self._item_types_combo_box, expand=True, fill=True)
for combo_box in self._item_combo_boxes:
combo_box.widget.show_all()
combo_box.widget.hide()
combo_box.widget.set_no_show_all(True)
self._item_types_combo_box.append_text(
combo_box.name.encode(pgconstants.GTK_CHARACTER_ENCODING))
self.pack_start(combo_box.widget, expand=True, fill=True)
combo_box.widget.connect("changed", self._on_combo_box_changed)
self._item_types_combo_box.connect("changed", self._on_item_types_combo_box_changed)
self._item_types_combo_box.set_active(0)
示例4: addParam
# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import combo_box_new_text [as 别名]
def addParam(self, name, field, ptype, *args):
x = self.tblGeneral.rows
self.tblGeneral.rows += 1
value = eval(field)
if ptype==bool:
obj = gtk.CheckButton()
obj.set_label(name)
obj.set_active(value)
obj.set_alignment(0, 0.5)
obj.show()
obj.field=field
self.tblGeneral.attach(obj, 0, 2, x, x+1, gtk.EXPAND|gtk.FILL, 0)
elif ptype==int:
obj = gtk.SpinButton(climb_rate=10)
if len(args)==2:
obj.set_range(args[0], args[1])
obj.set_increments(1, 10)
obj.set_numeric(True)
obj.set_value(value)
obj.show()
obj.field=field
lbl = gtk.Label(name)
lbl.set_alignment(0, 0.5)
lbl.show()
self.tblGeneral.attach(lbl, 0, 1, x, x+1, gtk.FILL, 0)
self.tblGeneral.attach(obj, 1, 2, x, x+1, gtk.EXPAND|gtk.FILL, 0)
elif ptype==list:
obj = gtk.combo_box_new_text()
for s in args[0]:
obj.append_text(s)
obj.set_active(value)
obj.show()
obj.field=field
lbl = gtk.Label(name)
lbl.set_alignment(0, 0.5)
lbl.show()
self.tblGeneral.attach(lbl, 0, 1, x, x+1, gtk.FILL, 0)
self.tblGeneral.attach(obj, 1, 2, x, x+1, gtk.EXPAND|gtk.FILL, 0)
else:
obj = gtk.Entry()
obj.set_text(value)
obj.show()
obj.field=field
lbl = gtk.Label(name)
lbl.set_alignment(0, 0.5)
lbl.show()
self.tblGeneral.attach(lbl, 0, 1, x, x+1, gtk.FILL, 0)
self.tblGeneral.attach(obj, 1, 2, x, x+1, gtk.EXPAND|gtk.FILL, 0)