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


Python Window.draw方法代碼示例

本文整理匯總了Python中Window.draw方法的典型用法代碼示例。如果您正苦於以下問題:Python Window.draw方法的具體用法?Python Window.draw怎麽用?Python Window.draw使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Window的用法示例。


在下文中一共展示了Window.draw方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: SFTaxiTest

# 需要導入模塊: import Window [as 別名]
# 或者: from Window import draw [as 別名]
def SFTaxiTest(polies,verts):
	sfTaxiShader= SFTaxiShader([poly.centroid for poly in polies])
	window= Window()
	mouseCursor= MouseCursor(window)

	sfObjects= SFObjects(polies,verts)

	clickPos=None ; clock = sf.Clock()
	while window.is_open:
		tDelta= clock.restart().seconds

		sfObjects.setScale(window.view.size.x/window.size.x)

		window.clear()
		#window.draw(sfTaxiShader)
		sfTaxiShader.quad.align(window)
		sfObjects.quadCorners = sfTaxiShader.quad.corners()
		sfObjects.updateRays(sfTaxiShader.corners())
		window.draw(sfObjects)
		window.draw(mouseCursor)
		window.display()

		checkNavKeys(window,tDelta,mouseCursor.pos)
		for event in window.events:
			if		type(event) is sf.CloseEvent:			window.close()
			elif	type(event) is sf.MouseButtonEvent and event.pressed:
				if event.button==sf.Mouse.LEFT:			sfObjects.clickedAt(mouseCursor.pos)
				else:	checkForNavEvents(window,event,mouseCursor.pos)
			elif	type(event) is sf.KeyEvent and event.pressed:
				if		event.code == sf.Keyboard.ESCAPE: window.close()
				elif	event.code == sf.Keyboard.P:	sfObjects.clickedAt= selectPoly
				elif	event.code == sf.Keyboard.I:	sfObjects.clickedAt= selectIntersect
				else:	checkForNavEvents(window,event,mouseCursor.pos)
			else:	checkForNavEvents(window,event,mouseCursor.pos)
開發者ID:bobbysoon,項目名稱:TaxiVoronoi,代碼行數:36,代碼來源:__init__.py

示例2: Window

# 需要導入模塊: import Window [as 別名]
# 或者: from Window import draw [as 別名]
#!/usr/bin/env python2

from Common import *
from Image import *
from Window import *

window = Window("DanRTS", 720)

believe = Image("believe.png")
window.add(believe)

while not done():
	window.events()
	window.draw()


開發者ID:TheHistorian,項目名稱:DanRTS,代碼行數:16,代碼來源:__main__.py


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