本文整理汇总了Python中gtk.Label.show方法的典型用法代码示例。如果您正苦于以下问题:Python Label.show方法的具体用法?Python Label.show怎么用?Python Label.show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gtk.Label
的用法示例。
在下文中一共展示了Label.show方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _setup_layout
# 需要导入模块: from gtk import Label [as 别名]
# 或者: from gtk.Label import show [as 别名]
def _setup_layout(self):
hpaned = HPaned()
label = Label(_("Are you sure you want to install/remove those packages?"))
label.show()
inst_frame = Frame(_("Packages to install"))
rem_frame = Frame(_("Packages to remove"))
inst_scroll = ScrolledWindow()
inst_scroll.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)
rem_scroll = ScrolledWindow()
rem_scroll.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)
inst_scroll.add(self.install_tree)
rem_scroll.add(self.remove_tree)
inst_frame.add(inst_scroll)
rem_frame.add(rem_scroll)
hpaned.pack1(inst_frame, False, False)
hpaned.pack2(rem_frame, False, False)
hpaned.show_all()
self.vbox.pack_start(label, False, False, 0)
self.vbox.pack_start(hpaned, True, True, 0)
self.set_default_size(600,300)
return
示例2: _DownloadStatus
# 需要导入模块: from gtk import Label [as 别名]
# 或者: from gtk.Label import show [as 别名]
class _DownloadStatus(HBox):
def __init__(self, queue):
HBox.__init__(self)
self.thread = DlWorker(queue, self.progress, self.set_url)
self.label = Label("hello")
self.pbar = ProgressBar()
self.pack_start(self.label, FALSE, FALSE, 0)
self.pack_end(self.pbar, FALSE, FALSE, 0)
self.label.show()
self.pbar.show()
self.show()
self._done = False
self._started = False
def progress(self, dt, dd, ut, ud):
threads_enter()
print "in progress", dt, dd, ut, ud
if dt == 0:
self._done += 0.1
if self._done >= 1:
self._done = 0
else:
self._done = float(dd) / float(dt)
print "_done", self._done
self.pbar.set_fraction(self._done)
threads_leave()
def set_url(self, url):
self.label.set_text(url)
def start(self, *args):
if not self._started:
self.thread.start()
self._started = True
示例3: __init__
# 需要导入模块: from gtk import Label [as 别名]
# 或者: from gtk.Label import show [as 别名]
def __init__(self):
HBox.__init__(self)
self.set_spacing(3)
#hour spin
self.__hour_spin = SpinButton()
self.__hour_spin.set_range(00, 99)
self.__hour_spin.set_width_chars(2)
self.__hour_spin.set_increments(1, 1)
self.__hour_spin.set_numeric(True)
self.__hour_spin.set_update_policy(UPDATE_IF_VALID)
self.__hour_spin.set_snap_to_ticks(True)
self.__hour_spin.connect("output", self._on_spin_output)
self.__hour_spin_handler = (self.__hour_spin.connect("value-changed",
self.hour_spin_changed))
self.pack_start(self.__hour_spin)
self.__hour_spin.show()
#separator
sep = Label(":")
self.pack_start(sep, expand=False)
sep.show()
#minute spin
self.__minute_spin = SpinButton()
self.__minute_spin.set_range(00, 59)
self.__minute_spin.set_width_chars(2)
self.__minute_spin.set_increments(1, 1)
self.__minute_spin.set_numeric(True)
self.__minute_spin.set_wrap(True)
self.__minute_spin.set_update_policy(UPDATE_IF_VALID)
self.__minute_spin.set_snap_to_ticks(True)
self.__minute_spin.connect("output", self._on_spin_output)
self.__minute_spin.connect("wrapped", self._on_minute_wrap)
self.__minute_spin_handler = (self.__minute_spin.connect("value-changed",
self.minute_spin_changed))
self.pack_start(self.__minute_spin)
self.__minute_spin.show()
#separator
self.__second_sep = Label(":")
self.pack_start(self.__second_sep, expand=False)
self.__second_sep.show()
#seconds spin
self.__second_spin = SpinButton()
self.__second_spin.set_range(00, 59)
self.__second_spin.set_width_chars(2)
self.__second_spin.set_increments(1, 1)
self.__second_spin.set_numeric(True)
self.__second_spin.set_wrap(True)
self.__second_spin.set_update_policy(UPDATE_IF_VALID)
self.__second_spin.set_snap_to_ticks(True)
self.__second_spin.connect("output", self._on_spin_output)
self.__second_spin.connect("wrapped", self._on_second_wrap)
self.__second_spin_handler = (self.__second_spin.connect("value-changed",
self.second_spin_changed))
self.pack_start(self.__second_spin)
self.__second_spin.show()
示例4: _setup_layout
# 需要导入模块: from gtk import Label [as 别名]
# 或者: from gtk.Label import show [as 别名]
def _setup_layout(self):
label = Label(_("This packages requires one of the packages you've selected for removal.\nDo you want to remove them all?"))
label.show()
self.vbox.pack_start(label, False, False, 0)
self.vbox.pack_start(self.tree, True, True, 0)
return
示例5: Dialog
# 需要导入模块: from gtk import Label [as 别名]
# 或者: from gtk.Label import show [as 别名]
class Dialog(_GenDialog):
def __init__(self, message, name='Dialog'):
_GenDialog.__init__(self, name=name)
self.set_name(name)
self.label = Label(message)
self.vbox.pack_start(self.label, FALSE, TRUE, 0)
self.vbox.set_homogeneous(FALSE)
self.label.show()
示例6: SourceStatus
# 需要导入模块: from gtk import Label [as 别名]
# 或者: from gtk.Label import show [as 别名]
class SourceStatus(VBox):
def __init__(self):
VBox.__init__(self)
self.status_label = Label('blank')
self.source_label = Label('blank')
self.pack_start(self.status_label, FALSE, FALSE, 0)
self.pack_end(self.source_label, FALSE, FALSE, 0)
self.status_label.show()
self.source_label.show()
self.show()
示例7: upgrade_confirm_dialog
# 需要导入模块: from gtk import Label [as 别名]
# 或者: from gtk.Label import show [as 别名]
class upgrade_confirm_dialog(Dialog):
def __init__(self, parent, to_upgrade, icon):
Dialog.__init__(self, _("Confirm Upgrade"), parent,
DIALOG_MODAL | DIALOG_DESTROY_WITH_PARENT,
(STOCK_OK, RESPONSE_ACCEPT,
STOCK_CANCEL, RESPONSE_REJECT))
self.set_icon(pixbuf_new_from_file(icon))
self._setup_tree(to_upgrade)
self._setup_layout()
def _setup_tree(self, pacs):
self.model = ListStore(str, str, str)
for pac in pacs:
self.model.append(["yellow", pac.name, pac.version])
continue
self.tree = TreeView()
self.tree.insert_column_with_attributes(-1, "", CellRendererPixbuf(),
stock_id = 0)
self.tree.insert_column_with_attributes(-1, "Package",
CellRendererText(), text = 1)
self.tree.insert_column_with_attributes(-1, "Version",
CellRendererText(), text = 2)
self.tree.set_model(self.model)
self.tree.show()
def _setup_layout(self):
self.label = Label(_("Are you sure yo want to upgrade those packages?\n"))
self.label.show()
self.set_default_size (300, 300)
scr = ScrolledWindow()
scr.set_policy("automatic", "automatic")
scr.add(self.tree)
scr.show()
self.vbox.pack_start(self.label, False, False, 0)
self.vbox.pack_start(scr, True, True, 0)
def run(self):
retcode = Dialog.run(self)
self.destroy()
if retcode == RESPONSE_ACCEPT:
return True
else:
return False
示例8: _FieldEntry
# 需要导入模块: from gtk import Label [as 别名]
# 或者: from gtk.Label import show [as 别名]
class _FieldEntry(HBox):
def __init__(self, name, default=None):
HBox.__init__(self)
self.set_name(name)
self.label = Label(name)
self.entry = Entry()
self.pack_start(self.label, True, True, 0)
self.add(self.entry)
self.label.show()
self.entry.show()
if default:
self.set(default)
self.show()
def set(self, value):
self.entry.set_text(value)
示例9: _setup_layout
# 需要导入模块: from gtk import Label [as 别名]
# 或者: from gtk.Label import show [as 别名]
def _setup_layout(self, conflict):
self.set_default_size(-1,250)
if not conflict:
label = Label(_("These packages are required by package(s) you've selected for removal.\nDo you want to remove them all?"))
else:
label = Label("Package(s) that are about to be installed conflicts \nwith package(s) that are already installed.\nDo you want to remove them?")
label.show()
scr = ScrolledWindow()
scr.set_policy(POLICY_AUTOMATIC, POLICY_AUTOMATIC)
scr.add(self.tree)
self.vbox.pack_start(label, False, False, 0)
self.vbox.pack_start(scr, True, True, 0)
self.vbox.show_all()
return
示例10: ItemEntry
# 需要导入模块: from gtk import Label [as 别名]
# 或者: from gtk.Label import show [as 别名]
class ItemEntry(HBox):
def __init__(self, item, name='ItemEntry'):
if len(item) != 2:
raise Error, 'ItemEntry needs item not %s' %item
field, value = item
HBox.__init__(self)
self.set_name(name)
self.label = Label(field)
self.pack_start(self.label, FALSE, FALSE, 0)
self.entry = Entry()
self.set(str(value))
self.pack_end(self.entry, TRUE, TRUE, 0)
self.label.show()
self.entry.show()
self.show()
def get(self):
return self.entry.get_text()
def set(self, value):
self.entry.set_text(value)
def fieldname(self):
return self.label.get_text()
示例11: DownloadStatus
# 需要导入模块: from gtk import Label [as 别名]
# 或者: from gtk.Label import show [as 别名]
class DownloadStatus(VBox):
def __init__(self, url, path):
VBox.__init__(self)
self.label = Label(path)
self.label.show()
self.pack_start(self.label, FALSE, FALSE, 0)
self.pbar = ProgressBar()
self.pack_end(self.pbar, FALSE, FALSE, 0)
self.pbar.show()
self.show()
self._done = 0
# self.thread = DownloadThread(url, path, self.progress)
self.thread = DownloadThread(url, path, self.progress)
# self.button = Button('start')
# self.button.connect('clicked', self.start)
# self.button.show()
# self.pack_end(self.button, FALSE, FALSE, 0)
self._started = False
def progress(self, dt, dd, ut, ud):
threads_enter()
print "in progress", dt, dd, ut, ud
if dt == 0:
self._done += 0.1
if self._done >= 1:
self._done = 0
else:
self._done = float(dd) / float(dt)
print "_done", self._done
self.pbar.set_fraction(self._done)
threads_leave()
def start(self, *args):
if not self._started:
self.thread.start()
self._started = True
示例12: HourEntry
# 需要导入模块: from gtk import Label [as 别名]
# 或者: from gtk.Label import show [as 别名]
class HourEntry(HBox):
__gtype_name__ = 'HourEntry'
__gproperties__ = {
'hour' : (TYPE_PYOBJECT, 'Hour', 'The hour currently selected', PARAM_READWRITE),
'minute' : (TYPE_PYOBJECT, 'Minute', 'The minute currently selected', PARAM_READWRITE),
'second' : (TYPE_PYOBJECT, 'Second', 'The second currently selected', PARAM_READWRITE),
}
__gsignals__ = {
'time_changed' : (SIGNAL_RUN_LAST, TYPE_NONE, ()),
}
hour = 00
minute = 00
second = 00
lock = False
def __init__(self):
HBox.__init__(self)
self.set_spacing(3)
#hour spin
self.__hour_spin = SpinButton()
self.__hour_spin.set_range(00, 99)
self.__hour_spin.set_width_chars(2)
self.__hour_spin.set_increments(1, 1)
self.__hour_spin.set_numeric(True)
self.__hour_spin.set_update_policy(UPDATE_IF_VALID)
self.__hour_spin.set_snap_to_ticks(True)
self.__hour_spin.connect("output", self._on_spin_output)
self.__hour_spin_handler = (self.__hour_spin.connect("value-changed",
self.hour_spin_changed))
self.pack_start(self.__hour_spin)
self.__hour_spin.show()
#separator
sep = Label("hh:")
self.pack_start(sep, expand=False)
sep.show()
#minute spin
self.__minute_spin = SpinButton()
self.__minute_spin.set_range(00, 59)
self.__minute_spin.set_width_chars(2)
self.__minute_spin.set_increments(1, 1)
self.__minute_spin.set_numeric(True)
self.__minute_spin.set_wrap(True)
self.__minute_spin.set_update_policy(UPDATE_IF_VALID)
self.__minute_spin.set_snap_to_ticks(True)
self.__minute_spin.connect("output", self._on_spin_output)
self.__minute_spin.connect("wrapped", self._on_minute_wrap)
self.__minute_spin_handler = (self.__minute_spin.connect("value-changed",
self.minute_spin_changed))
self.pack_start(self.__minute_spin)
self.__minute_spin.show()
#separator
self.__second_sep = Label("mn:")
self.pack_start(self.__second_sep, expand=False)
self.__second_sep.show()
#seconds spin
self.__second_spin = SpinButton()
self.__second_spin.set_range(00, 59)
self.__second_spin.set_width_chars(2)
self.__second_spin.set_increments(1, 1)
self.__second_spin.set_numeric(True)
self.__second_spin.set_wrap(True)
self.__second_spin.set_update_policy(UPDATE_IF_VALID)
self.__second_spin.set_snap_to_ticks(True)
self.__second_spin.connect("output", self._on_spin_output)
self.__second_spin.connect("wrapped", self._on_second_wrap)
self.__second_spin_handler = (self.__second_spin.connect("value-changed",
self.second_spin_changed))
self.pack_start(self.__second_spin)
self.__second_spin.show()
self.__ss_sep = Label("ss")
self.pack_start(self.__ss_sep, expand=False)
self.__ss_sep.show()
def set_hour(self, hour):
self.__hour_spin.set_value(hour)
self.hour = int(self.__hour_spin.get_value())
def set_minute(self, minute):
self.__minute_spin.set_value(minute)
self.minute = int(self.__minute_spin.get_value())
def set_second(self, second):
self.__second_spin.set_value(second)
self.second = int(self.__second_spin.get_value())
def set_time(self, hour, minute):
self.__hour_spin.handler_block(self.__hour_spin_handler)
self.__minute_spin.handler_block(self.__minute_spin_handler)
self.__second_spin.handler_block(self.__second_spin_handler)
#.........这里部分代码省略.........
示例13: Base
# 需要导入模块: from gtk import Label [as 别名]
# 或者: from gtk.Label import show [as 别名]
class Base(object):
def __init__(self):
from gtk import Window,WINDOW_TOPLEVEL,Button,Label,HBox,Entry,VBox,VSeparator
self.window = Window(WINDOW_TOPLEVEL)
self.window.set_title("Slideshow")
self.window.connect("delete_event", self.delete_event)
self.window.set_border_width(10)
self.vbox = VBox(False, 0)
self.window.add(self.vbox)
self.hbox1 = HBox(False, 0)
self.vbox.pack_start(self.hbox1, True, True, 1)
self.hbox = HBox(False, 0)
self.vbox.pack_start(self.hbox, False, False, 1)
self.hbox2 = HBox(False, 0)
self.vbox.pack_start(self.hbox2, True, True, 1)
self.label = Label('Identifikační číslo:')
self.hbox.pack_start(self.label, False, False, 1)
self.label.show()
self.editable = Entry()
self.editable.connect('key_press_event', self.key_press_event)
self.hbox.pack_start(self.editable, True, True, 1)
self.editable.show()
self.button = Button("Začít")
self.button.connect("clicked", self.callback)
self.button.set_receives_default(True)
self.button.set_can_focus(True)
self.hbox.pack_start(self.button, False, False, 1)
self.button.show()
self.hbox1.show()
self.hbox.show()
self.hbox2.show()
self.vbox.show()
self.window.show()
def delete_event(self, widget, event, data=None):
gtk.main_quit()
return False
def key_press_event(self, widget, event):
from gtk.gdk import keyval_from_name,keyval_name
if event.keyval in (keyval_from_name('Return'),keyval_from_name('KP_Enter')):
self.callback(widget)
def _getFilePaths(self, fileTypes, recursive=True):
import os
import re
from sys import argv
pt = re.compile(r'.*([%(0)s][^%(0)s]*)'%{'0':os.path.extsep})
path = [a for m,a in ((pt.match(os.path.basename(a)),a) for a in argv[1:]) if m and m.group(1) in fileTypes]
if not path:
path = '/home/pi/img/*.jpg'
if isinstance(path, str):
## Returns list containing paths of files in /path/ that are of a file type in /fileTypes/,
## if /recursive/ is False subdirectories are not checked.
paths = []
if recursive:
for root, folders, files in os.walk(path, followlinks=True):
for file in files:
for fileType in fileTypes:
if file.endswith(fileType):
paths.append(os.path.join(root, file))
else:
for item in os.listdir(path):
for fileType in fileTypes:
if item.endswith(fileType):
paths.append(os.path.join(root, item))
return paths
elif iterable(path):
return path
else:
return []
def _init_cb(self,trans):
from threading import Thread
if not iterable(trans):
trans = trans,
callbacks = []
for name,cb in trans:
t = Thread(target=cb, name='%sThread'%name)
t.daemon = True
t.start()
callbacks.append(cb.enqueue)
def wrap(msg):
for cb in callbacks:
if not cb(msg):
return False
return True
return wrap
def callback(self, widget):
from slideshow import SlideShow
from trans import Message,GpioTransceiver,JsonTransceiver
if not self.editable.get_text():
return False
img_cbs = self._init_cb([('ImgGpioCallback',GpioTransceiver(24)),('ImgJsonCallback',JsonTransceiver('img.json'))])
kp_cbs = self._init_cb([('KpGpioCallback',GpioTransceiver(26,bcd=False)),('KpJsonCallback',JsonTransceiver('kp.json'))])
def ordfnc(path):
from numpy.random import permutation
gray = path[0]
result = []
for p in permutation(path[1:]):
result.append(p)
result.append(gray)
return result
#.........这里部分代码省略.........