本文整理匯總了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)