当前位置: 首页>>代码示例>>Python>>正文


Python gtk.SpinButton方法代码示例

本文整理汇总了Python中gtk.SpinButton方法的典型用法代码示例。如果您正苦于以下问题:Python gtk.SpinButton方法的具体用法?Python gtk.SpinButton怎么用?Python gtk.SpinButton使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gtk的用法示例。


在下文中一共展示了gtk.SpinButton方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _create_gui_element

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import SpinButton [as 别名]
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 
开发者ID:khalim19,项目名称:gimp-plugin-export-layers,代码行数:19,代码来源:presenters_gtk.py

示例2: _create_spin_button

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import SpinButton [as 别名]
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 
开发者ID:khalim19,项目名称:gimp-plugin-export-layers,代码行数:27,代码来源:presenters_gtk.py

示例3: _init_gui

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import SpinButton [as 别名]
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) 
开发者ID:khalim19,项目名称:gimp-plugin-export-layers,代码行数:28,代码来源:itembox.py

示例4: _init_gui

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import SpinButton [as 别名]
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() 
开发者ID:khalim19,项目名称:gimp-plugin-export-layers,代码行数:53,代码来源:parasitebox.py

示例5: addParam

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import SpinButton [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) 
开发者ID:mjun,项目名称:gnome-connection-manager,代码行数:50,代码来源:gnome_connection_manager.py

示例6: on_okbutton1_clicked

# 需要导入模块: import gtk [as 别名]
# 或者: from gtk import SpinButton [as 别名]
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 { 
开发者ID:mjun,项目名称:gnome-connection-manager,代码行数:53,代码来源:gnome_connection_manager.py


注:本文中的gtk.SpinButton方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。