當前位置: 首頁>>代碼示例>>Python>>正文


Python Graphics.paint方法代碼示例

本文整理匯總了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)
開發者ID:Spacejoker,項目名稱:one-week-one-man,代碼行數:37,代碼來源:main.py


注:本文中的graphics.Graphics.paint方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。