本文整理匯總了Python中gtk.Label.set_text方法的典型用法代碼示例。如果您正苦於以下問題:Python Label.set_text方法的具體用法?Python Label.set_text怎麽用?Python Label.set_text使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類gtk.Label
的用法示例。
在下文中一共展示了Label.set_text方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _DownloadStatus
# 需要導入模塊: from gtk import Label [as 別名]
# 或者: from gtk.Label import set_text [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
示例2: multipage_glade_editor
# 需要導入模塊: from gtk import Label [as 別名]
# 或者: from gtk.Label import set_text [as 別名]
#.........這裏部分代碼省略.........
event_handlers_dict = {}
load_glade_file_get_widgets_and_connect_signals(
glade_file, top_glade_element,
widget_dict, event_handlers_dict )
widget_dict[top_glade_element].hide()
return widget_dict
def __setup_auto_widgets(self):
# go through each page
for key, widget_dict in self.glade_pages_by_ident_index.iteritems():
# go through each widget
for widget_name, widget in widget_dict.iteritems():
widget_key = (key, widget_name)
# determine if the current widget is one that we can take
# care of automatically saving, we do this with a linear
# search through a table of eligible types,
# where the first element of each entry is Widget class
#
# Once we have a match do one of the following
# * Change the widget from the existing stored stage
# * Establish new state from some default
# The next two entries in the table
# (change_widget_from_state, new_state_from_widget)
# provide functions to do this
#
# Lastly, we establish event handlers for this widget using
# the last element in the table
for (cls,
change_widget_from_state, new_state_from_widget,
establish_event_handlers) in ( # start table
(Entry,
lambda w, wk: w.set_text(self.trans.get_widget_state(wk)),
lambda w: '',
lambda w: w.connect("changed", self.entry_changed),
), # Entry
(Calendar,
self.__change_calendar_from_saved_version,
get_current_date_of_gtkcal,
lambda w: w.connect( "day_selected",
self.calendar_changed ),
), # Calendar
(CheckButton,
lambda w, wk:
w.set_active(self.trans.get_widget_state(wk)),
get_state_of_checkbutton,
lambda w: w.connect("toggled", self.checkbutton_changed),
), # CheckButton
): # end of table and for declartion
# does the widget match the type in the current table entry?
if isinstance(widget, cls):
# use the three remaining functions in the table
# as appropriate
if self.trans.has_widget_state( widget_key ):
change_widget_from_state(widget, widget_key)
else:
self.trans.update_widget_state(
widget_key,
new_state_from_widget(widget) )
establish_event_handlers(widget)