pygame.draw.arc - draw a partial section of an ellipse draw a partial section of an ellipse pygame.draw.line - draw a straight line segment draw a straight line segment pygame.draw.lines - draw multiple contiguous line segments draw multiple contiguous line segments pygame.draw.aaline - draw ...
pygame.draw.arc - draw a partial section of an ellipse draw a partial section of an ellipse pygame.draw.line - draw a straight line segment draw a straight line segment pygame.draw.lines - draw multiple contiguous line segments draw multiple contiguous line segments pygame.draw.aaline - draw ...
draw a round shape inside a rectangle #在矩形内画圆形状 line(...) line(Surface, color, start_pos, end_pos, width=1) -> Rect draw a straight line segment #画直线线段 lines(...) lines(Surface, color, closed, pointlist, width=1) -> Rect draw multiple contiguous line segments #绘制...
pygame.draw.arc-draw a partial sectionofan ellipse draw a partial sectionofan ellipse pygame.draw.line-draw a straight line segment draw a straight line segment pygame.draw.lines-draw multiple contiguous line segments draw multiple contiguous line segments pygame.draw.aaline-draw fine antialiased l...
lines(Surface, color, closed, pointlist, width=1) -> Rect draw multiple contiguous line segments polygon(...) polygon(Surface, color, pointlist, width=0) -> Rect draw a shape with any number of sides rect(...) rect(Surface, color, Rect, width=0) -> Rect ...
(19+i*20) # 使用pygame.draw.lines()函数绘制线段 points = list(zip(x,y)) pygame.draw.lines(screen, GREY, False, points, 1) # 线宽为1 points = list(zip(y,x)) pygame.draw.lines(screen, GREY, False, points, 1) # 重画蛇和食物 for pos in snake_pos: pygame.draw.rect(screen, ...
(19+i*20) # 使用pygame.draw.lines()函数绘制线段 points = list(zip(x,y)) pygame.draw.lines(screen, GREY, False, points, 1) # 线宽为1 points = list(zip(y,x)) pygame.draw.lines(screen, GREY, False, points, 1) # 重画蛇和食物 for pos in snake_pos: pygame.draw.rect(screen, ...
地图只有在发生变化时(比如玩家移动或推动星星)才需要重新绘制。因此,mapSurf 变量中的 Surface 对象只有在 mapNeedsRedraw 变量被设置为 True 时才会通过调用 drawMap() 函数进行更新。在第225 行绘制地图后,mapNeedsRedraw 变量被设置为 False。如果想要看到程序在游戏循环的每次迭代中绘制而变慢,可以注释掉第 226...
-> Rectlines(surface, color, closed, points, width=1) -> Rectdraw multiple contiguous straight line segmentspolygon(...)polygon(surface, color, points) -> Rectpolygon(surface, color, points, width=0) -> Rectdraw a polygonrect(...)rect(surface, color, rect) -> Rectrect(surface, color...
draw.circle(screen, (0, 0, 255), (250, 250), 75) 24 25 # Flip the display 26 pygame.display.flip() 27 28# Done! Time to quit. 29pygame.quit() When you run this program, you’ll see a window that looks like this: Let’s break this code down, section by section: Lines ...