本文整理汇总了Python中canvas.Canvas.get_mapped方法的典型用法代码示例。如果您正苦于以下问题:Python Canvas.get_mapped方法的具体用法?Python Canvas.get_mapped怎么用?Python Canvas.get_mapped使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类canvas.Canvas
的用法示例。
在下文中一共展示了Canvas.get_mapped方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Meter
# 需要导入模块: from canvas import Canvas [as 别名]
# 或者: from canvas.Canvas import get_mapped [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();
示例2: Meter
# 需要导入模块: from canvas import Canvas [as 别名]
# 或者: from canvas.Canvas import get_mapped [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();