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


Python Canvas.get_window方法代码示例

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


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

示例1: Meter

# 需要导入模块: from canvas import Canvas [as 别名]
# 或者: from canvas.Canvas import get_window [as 别名]
class Meter(object):

    canvas  = None;
    widgets = None;
    height  = None;
    width   = None;

    def __init__(self, width, height):
        self.canvas = Canvas();
        handler = MeterEventHandler(self);
        self.canvas.setup("below", handler);
        self.canvas.set_size(width, height);
        self.width = width;
        self.height = height;
        self.widgets = [];

    def add_widget(self, widget, x, y, x_alignment = -1, y_alignment = -1):
        self.widgets.append((widget, x, y, x_alignment, y_alignment));

    def refresh_func(self):
        self.canvas.redraw();
        return self.canvas.get_mapped();

    def show(self):
        self.canvas.show();
        GLib.timeout_add(200, self.refresh_func);

    def hide(self):
        self.canvas.hide();
        
    def get_window(self):
        return self.canvas.get_window();
开发者ID:xinhaoyuan,项目名称:rmdock,代码行数:34,代码来源:meter.py

示例2: Meter

# 需要导入模块: from canvas import Canvas [as 别名]
# 或者: from canvas.Canvas import get_window [as 别名]
class Meter(object):

  canvas = None;
  handler = None;
  width = None;
  height = None;
  hour_radius = None;
  min_radius = None;
  sec_radius = None;
  padding = 5;
  fill_color = None;
  opacity = None;
  
  def __init__(self, width, height):
    self.canvas = Canvas();
    handler = MeterEventHandler(self);
    self.canvas.setup("below", handler);
    self.canvas.set_size(width, height);
    
    self.width = width;
    self.height = height;
    self.hour_radius = 4;
    self.min_radius = 8;
    self.sec_radius = 6;
    self.padding = 5;
    # self.fill_color = (0.3, 0.7, 0.1);
    self.fill_color = (1.0, 1.0, 1.0);
    self.opacity = 0.5;

  def refresh_thread(self):
    self.canvas.redraw();
    return self.canvas.get_mapped();

  def show(self):
    self.canvas.show();
    GLib.timeout_add(200, self.refresh_thread);

  def hide(self):
    self.canvas.hide();

  def get_window(self):
    return self.canvas.get_window();
开发者ID:xinhaoyuan,项目名称:rmdock,代码行数:44,代码来源:meter_example.py


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