pygame.draw.circle - draw a circle around a point draw a circle around a point pygame.draw.ellipse - draw a round shape inside a rectangle draw a round shape inside a rectangle pygame.draw.arc - draw a partial section of an ellipse draw a partial section of an ellipse pygame.draw.line ...
pygame.draw.circle - draw a circle around a point draw a circle around a point pygame.draw.ellipse - draw a round shape inside a rectangle draw a round shape inside a rectangle pygame.draw.arc - draw a partial section of an ellipse draw a partial section of an ellipse pygame.draw.line ...
15 pygame.draw.rect(background, (0, 255, 0), ((200, 5), (100, 100)), 3) 16 17 #draw a filled circle 18 pygame.draw.circle(background, (0, 0, 255), (400, 50), 45) 19 20 #draw an arc 21 pygame.draw.arc(background, (0, 0, 0), ((5, 150), (100, 200)), 0, ...
代码: importpygamefrompygame.localsimport*defDrawCircle(screen):BLUE=(0,0,255)position=300,250radius=100width=10pygame.draw.circle(screen,BLUE,position,radius,width)defmain():pygame.init()pygame.display.set_caption('Draw circle')screen=pygame.display.set_mode([600,500])mRunning=TruewhilemRunnin...
# # Draw a circle # pygame.draw.circle(screen, BLUE, [60, 250], 40) # # Go ahead and update the screen with what we've drawn. # # This MUST happen after all the other drawing commands. #重新绘制所有图像 # pygame.display.flip() ...
pygame.draw.circle(screen, color, position, radius, width) ''' import pygame import sys from pygame.locals import * white = 255,255,255 blue = 0,0,200 pygame.init() screen = pygame.display.set_mode((600,500)) myfont = pygame.font.Font(None,60) ...
绘制圆形pygame.circle(surface, color, pos, radius, width=0)上述参数的含义如下:pos:该参数用来指定的圆心位置;radius:用来指定圆的半径;绘制椭圆形pygame.draw.ellipse(surface, color, Rect, width=0)绘制椭圆形的过程,其实就是在矩形区域内部(Rect)绘制一个内接椭圆形,其余参数与上述参数意思相同。绘制...
pygame.draw.circle(screen,(0,0,255),(250,250),75)# Flip the display pygame.display.flip()# Done!Time to quit.pygame.quit() 当你运行这个程序时,你会看到一个如下所示的窗口: 让我们逐段分解这段代码: 第4 行和第 5 行导入并初始化pygame库。没有这些行,就没有pygame. ...
pygame.gfxdraw.filled_circle(screen, Start_X + SIZE * i, Start_Y + SIZE * j, radius, BLACK_COLOR) # 画棋子 def _draw_chessman(screen, point, stone_color): # pygame.draw.circle(screen, stone_color, (Start_X + SIZE * point.X, Start_Y + SIZE * point.Y), Stone_Radius) ...
pg.draw.circle(self.screen,[0,0,0],[top,left],zhijing,1)pg.draw.rect(self.screen,[255,0,0],[left,top,width,height],3)defevent_loop(self):foreventinpg.event.get():ifevent.type==pg.QUIT:self.done=Trueifevent.type==pg.KEYDOWN:ifevent.key==pg.K_ESCAPE:self.done=Truedefdraw(...