Python gtk.combo_box_new_text() Examples
The following are 4
code examples of gtk.combo_box_new_text().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
gtk
, or try the search function
.
Example #1
Source File: tintwizard.py From malfs-milis with MIT License | 5 votes |
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
Example #2
Source File: memview.py From nightmare with GNU General Public License v2.0 | 4 votes |
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()
Example #3
Source File: gimpitemcombobox.py From gimp-plugin-export-layers with GNU General Public License v3.0 | 4 votes |
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)
Example #4
Source File: gnome_connection_manager.py From gnome-connection-manager with GNU General Public License v3.0 | 4 votes |
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)