Python gtk.SpinButton() Examples
The following are 6
code examples of gtk.SpinButton().
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
.
![](https://www.programcreek.com/common/static/images/search.png)
Example #1
Source File: presenters_gtk.py From gimp-plugin-export-layers with GNU General Public License v3.0 | 6 votes |
def _create_gui_element(self, setting): display_id = getattr(setting.value, "ID", 0) spin_button = gtk.SpinButton( gtk.Adjustment( value=display_id, lower=0, upper=2**32, step_incr=1, page_incr=10, ), digits=0) spin_button.set_numeric(True) spin_button.set_value(display_id) return spin_button
Example #2
Source File: presenters_gtk.py From gimp-plugin-export-layers with GNU General Public License v3.0 | 6 votes |
def _create_spin_button(setting, digits=0): if hasattr(setting, "min_value") and setting.min_value is not None: min_value = setting.min_value else: min_value = -2**32 if hasattr(setting, "max_value") and setting.max_value is not None: max_value = setting.max_value else: max_value = 2**32 spin_button = gtk.SpinButton( gtk.Adjustment( value=setting.value, lower=min_value, upper=max_value, step_incr=1, page_incr=10, ), digits=digits) spin_button.set_numeric(True) spin_button.set_value(setting.value) return spin_button
Example #3
Source File: itembox.py From gimp-plugin-export-layers with GNU General Public License v3.0 | 5 votes |
def _init_gui(self): self._size_spin_button = gtk.SpinButton( gtk.Adjustment( value=0, lower=self._min_size, upper=self._max_size, step_incr=1, page_incr=10, ), digits=0) self._size_spin_button.set_numeric(True) self._size_spin_button.set_value(0) self._size_spin_button_label = gtk.Label(_("Size")) self._size_hbox = gtk.HBox() self._size_hbox.set_spacing(self._SIZE_HBOX_SPACING) self._size_hbox.pack_start(self._size_spin_button_label, expand=False, fill=False) self._size_hbox.pack_start(self._size_spin_button, expand=False, fill=False) self._vbox.pack_start(self._size_hbox, expand=False, fill=False) self._vbox.reorder_child(self._size_hbox, 0) self._size_spin_button.connect( "value-changed", self._on_size_spin_button_value_changed)
Example #4
Source File: parasitebox.py From gimp-plugin-export-layers with GNU General Public License v3.0 | 4 votes |
def _init_gui(self, parasite): self._parasite_name_entry = gtk.Entry() self._parasite_flags_spin_button = gtk.SpinButton( gtk.Adjustment( value=parasite.flags, lower=0, upper=2**32, step_incr=1, page_incr=10, ), digits=0) self._parasite_flags_spin_button.set_numeric(True) self._parasite_data_entry = gtk.Entry() self._vbox_name_label = gtk.Label( _("Name").encode(pgconstants.GTK_CHARACTER_ENCODING)) self._vbox_name_label.set_alignment(0.0, 0.5) self._vbox_name = gtk.VBox() self._vbox_name.set_spacing(self._VBOX_SPACING) self._vbox_name.pack_start(self._vbox_name_label, expand=False, fill=False) self._vbox_name.pack_start(self._parasite_name_entry, expand=False, fill=False) self._vbox_flags_label = gtk.Label( _("Flags").encode(pgconstants.GTK_CHARACTER_ENCODING)) self._vbox_flags_label.set_alignment(0.0, 0.5) self._vbox_flags = gtk.VBox() self._vbox_flags.set_spacing(self._VBOX_SPACING) self._vbox_flags.pack_start(self._vbox_flags_label, expand=False, fill=False) self._vbox_flags.pack_start( self._parasite_flags_spin_button, expand=False, fill=False) self._vbox_data_label = gtk.Label( _("Data").encode(pgconstants.GTK_CHARACTER_ENCODING)) self._vbox_data_label.set_alignment(0.0, 0.5) self._vbox_data = gtk.VBox() self._vbox_data.set_spacing(self._VBOX_SPACING) self._vbox_data.pack_start(self._vbox_data_label, expand=False, fill=False) self._vbox_data.pack_start(self._parasite_data_entry, expand=False, fill=False) self.set_spacing(self._HBOX_SPACING) self.pack_start(self._vbox_name, expand=False, fill=False) self.pack_start(self._vbox_flags, expand=False, fill=False) self.pack_start(self._vbox_data, expand=False, fill=False) self._set_values(parasite) self._connect_changed_events()
Example #5
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)
Example #6
Source File: gnome_connection_manager.py From gnome-connection-manager with GNU General Public License v3.0 | 4 votes |
def on_okbutton1_clicked(self, widget, *args): for obj in self.tblGeneral: if hasattr(obj, "field"): if isinstance(obj, gtk.CheckButton): value = obj.get_active() elif isinstance(obj, gtk.SpinButton): value = obj.get_value_as_int() elif isinstance(obj, gtk.ComboBox): value = obj.get_active() else: value = '"%s"' % (obj.get_text()) exec("%s=%s" % (obj.field, value)) if self.get_widget("chkDefaultColors").get_active(): conf.FONT_COLOR="" conf.BACK_COLOR="" else: conf.FONT_COLOR = self.btnFColor.selected_color conf.BACK_COLOR = self.btnBColor.selected_color if self.btnFont.selected_font.to_string() != 'monospace' and not self.chkDefaultFont.get_active(): conf.FONT = self.btnFont.selected_font.to_string() else: conf.FONT = '' #Guardar shortcuts scuts={} for x in self.treeModel: if x[0]!='' and x[1]!='': scuts[x[1]] = [x[0]] for x in self.treeModel2: if x[0]!='' and x[1]!='': scuts[x[1]] = x[0] global shortcuts shortcuts = scuts #Boton donate global wMain if conf.HIDE_DONATE: wMain.get_widget("btnDonate").hide_all() else: wMain.get_widget("btnDonate").show_all() #Recrear menu de comandos personalizados wMain.populateCommandsMenu() wMain.writeConfig() self.get_widget("wConfig").destroy() #-- Wconfig.on_okbutton1_clicked } #-- Wconfig.on_btnBColor_clicked {