本文整理汇总了Python中gtk.Label类的典型用法代码示例。如果您正苦于以下问题:Python Label类的具体用法?Python Label怎么用?Python Label使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Label类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _DownloadStatus
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
示例2: _setup_layout
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
示例3: __init__
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
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
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: create_encoding_box
def create_encoding_box(combobox):
from i18n import msg0157
from gtk import Label, HBox
label = Label(msg0157)
label.set_use_underline(True)
hbox = HBox(homogeneous=False, spacing=10)
hbox.pack_start(label, False, False, 0)
hbox.pack_start(combobox, True, True, 0)
return hbox
示例7: __init__
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()
示例8: upgrade_confirm_dialog
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
示例9: create_menuitem
def create_menuitem(string, stock_id=None):
from gtk import MenuItem, Image, HBox, Label
hbox = HBox(spacing=7)
hbox.set_property("border-width", 2)
if stock_id:
image = Image()
image.set_property("stock", stock_id)
hbox.pack_start(image, False, False, 0)
label = Label(string)
label.set_property("use-underline", True)
hbox.pack_start(label, False, False, 0)
menuitem = MenuItem()
menuitem.add(hbox)
return menuitem
示例10: create_button
def create_button(stock_id, string):
from gtk import HBox, Image, Label, ICON_SIZE_BUTTON, Alignment
alignment = Alignment()
alignment.set_property("xalign", 0.5)
alignment.set_property("yalign", 0.5)
hbox = HBox(False, 3)
if stock_id:
image = Image()
image.set_from_stock(stock_id, ICON_SIZE_BUTTON)
hbox.pack_start(image, False, False, 0)
label = Label(string)
label.set_property("use-underline", True)
hbox.pack_start(label, False, False, 0)
alignment.add(hbox)
return alignment
示例11: _FieldEntry
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)
示例12: __init__
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()
示例13: __init__
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()
示例14: _setup_layout
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
示例15: __init__
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()