本文整理汇总了Python中graphics.Graphics.paint方法的典型用法代码示例。如果您正苦于以下问题:Python Graphics.paint方法的具体用法?Python Graphics.paint怎么用?Python Graphics.paint使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类graphics.Graphics
的用法示例。
在下文中一共展示了Graphics.paint方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: loop
# 需要导入模块: from graphics import Graphics [as 别名]
# 或者: from graphics.Graphics import paint [as 别名]
def loop():
g = Graphics()
last_paint = 0
pygame.key.set_repeat(500, 100)
model = type('Model', (object,), {})
model.exit = False
model.new_scene = 'main_menu'
model.wait = False
t = time.time()
while not model.exit:
while model.new_scene != None:
next_scene = model.new_scene
model.new_scene = None
clazz = scenes[next_scene]
#give the scene a handle to the mixer
scene = clazz(model)
events = pygame.event.get()
keymap = {}
for event in events:
if event.type == pygame.KEYDOWN:
if event.type == pygame.QUIT or (event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE):
return
scene.update(events, time_passed = time.time() - t)
t = time.time()
if time.time() - last_paint > 1/30.0 or model.wait:
#print 'fps: ', 1.0/(time.time() - last_paint)
last_paint = time.time()
g.paint(scene, model)