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


Python Label.set_text方法代码示例

本文整理汇总了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
开发者ID:BackupTheBerlios,项目名称:useless-svn,代码行数:36,代码来源:utils.py

示例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)
开发者ID:paritworkercoop,项目名称:bokeep-mirror,代码行数:70,代码来源:multipageglade.py


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