本文整理汇总了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
示例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
示例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)
示例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()
示例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)
示例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 {