2017-04-21 40 views

回答

1

如果您使用的是矩形(你應該是),它是超級簡單:

rect = image.get_rect() 
center_pos = rect.center 

的矩形類有很多超有用的句柄:

x,y 
top, left, bottom, right 
topleft, bottomleft, topright, bottomright 
midtop, midleft, midbottom, midright 
center, centerx, centery 
size, width, height 
w,h 

所有這些也可以分配到:

rect.center = (x, y) 
+0

謝謝幫助了很多! –

0

您還可以查詢圖像的大小。將角點座標調整爲每個方向的一半大小。