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


Python Canvas.queue_draw方法代码示例

本文整理汇总了Python中canvas.Canvas.queue_draw方法的典型用法代码示例。如果您正苦于以下问题:Python Canvas.queue_draw方法的具体用法?Python Canvas.queue_draw怎么用?Python Canvas.queue_draw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在canvas.Canvas的用法示例。


在下文中一共展示了Canvas.queue_draw方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Properties

# 需要导入模块: from canvas import Canvas [as 别名]
# 或者: from canvas.Canvas import queue_draw [as 别名]

#.........这里部分代码省略.........
                if name == "Image":
                    image = child.get_property("image")
                    entry = self.observer.get_observable("image-file")
                    entry.set_filename(image)
                if name == "BarCode":
                    code = child.get_property("code")
                    type = int(child.get_property("type"))
                    entry = self.observer.get_observable("barcode-code")
                    entry.set_text(code)
                    entry = self.observer.get_observable("barcode-type")
                    entry.set_active(type)
                if name == "Table":
                    columns = child.get_property("columns").split(':')
                    titles = child.get_property("titles").split(':')
                    rows = child.get_property("rows")
                    entry = self.observer.get_observable("table-rows")
                    entry.set_value(int(rows))
                    entry = self.observer.get_observable("table-columns")
                    entry.set_value(len(columns))
                    entry = self.observer.get_observable("table-columns-editor")
                    entry.clear()
                    for i, title in enumerate(titles):
                        entry.add_column(title, int(columns[i]))
            else:
                object.hide()

    def set_table_column_title(self, widget, column, title):
        for child in self.canvas.document.pages[0].children:
            if child.__name__ == "Table" and child.selected:
                titles = child.get_property('titles').split(':')
                titles[column] = title
                titles = ':'.join(titles)
                child.set_property('titles', titles)
                self.canvas.queue_draw()
                break

    def set_table_column_width(self, widget, column, width):
        for child in self.canvas.document.pages[0].children:
            if child.__name__ == "Table" and child.selected:
                columns = child.get_property('columns').split(':')
                columns[column] = str(width)
                columns = ':'.join(columns)
                child.set_property('columns', columns)
                self.canvas.queue_draw()
                break

    def set_table_columns(self, widget, data):
        n_columns = widget.spin.get_value_as_int()
        for child in self.canvas.document.pages[0].children:
            if child.__name__ == "Table" and child.selected:
                entry = self.observer.get_observable("table-columns-editor")
                columns = child.get_property('columns').split(':')
                titles = child.get_property('titles').split(':')
                if n_columns < len(columns):  # Remove column
                    del columns[n_columns]
                    del titles[n_columns]
                    entry.remove_column()
                elif n_columns > len(columns):  # Append column
                    columns.append('0')
                    title = _("Column %d") % n_columns
                    titles.append(title)
                    entry.add_column()
                else:
                    entry.add_column()
                columns = ':'.join(columns)
                #print titles
开发者ID:Happy-Ferret,项目名称:sanaviron,代码行数:70,代码来源:properties.py


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