本文整理匯總了Python中canvas.Canvas方法的典型用法代碼示例。如果您正苦於以下問題:Python canvas.Canvas方法的具體用法?Python canvas.Canvas怎麽用?Python canvas.Canvas使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類canvas
的用法示例。
在下文中一共展示了canvas.Canvas方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: import canvas [as 別名]
# 或者: from canvas import Canvas [as 別名]
def __init__(self, pixels, width, height):
self.pixels = pixels
self.width = width
self.height = height
self.canvas = Canvas(width, height, pixels)
# setup key handlers
key_esc = 27
self.handlers = {
key_esc: self.exit
}
self.v1 = Vertex(Vector(0, 0), Color.cyan())
self.v2 = Vertex(Vector(300, 100), Color.red())
self.v3 = Vertex(Vector(200, 300), Color.green())
示例2: timer_thread_proc
# 需要導入模塊: import canvas [as 別名]
# 或者: from canvas import Canvas [as 別名]
def timer_thread_proc(canvas:canvas.Canvas):
start_time = time.time()
while not quit_flag:
time.sleep(1.0)
canvas.show_timer(time.time() - start_time)
# main entry point for program. we'll call main() to do what needs to be done.