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


Python Polygon.translate方法代碼示例

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


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

示例1: of

# 需要導入模塊: from Polygon import Polygon [as 別名]
# 或者: from Polygon.Polygon import translate [as 別名]
# ˆThe left foot is also an ellipse with center point of (200,50), major
# axis is 20, and minor axis is 5.
img.blit( Ellipse(200,50,20,5).fill( Color(0, 255, 0) ) )

# The flag is constructed as such:
# ˆThe pole is a line with start and end points of (100,125) and (100,50).
line1 = Line(100, 125, 100, 50)

# ˆThe flag is a polygon with vertex points of (100,125), (100,95), and
# (60,110)
polygon1 = Polygon([(100,125), (100,95), (60,110)]).fill( Color(128, 0, 128) )

# ˆThe pole and flag are translated by (0,35), in order to fit in the right
# hand of the stick figure.
line1.translate(0,35)
polygon1.translate(0,35)

# ˆThe pole and flag are rotated by 45 degrees for a fix point of (100,100),
# so the flag and pole are tilted in the right hand of the stick figure.
line1.rotate(100,100,45)
polygon1.rotate(100,100,45)

# ˆThe pole and flag are scaled by 1.25 in the x and y values for a fix
# point of (100,100), to be larger in the right hand of the stick figure.
line1.scale(100,100,1.25,1.25)
polygon1.scale(100,100,1.25,1.25)

# Blit Rest
img.blit( line1 )
img.blit( polygon1 )
開發者ID:super3,項目名稱:ClassDev,代碼行數:32,代碼來源:man.py


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