Python 如何在PyGame中画一个圆?
您好,我在绘制圆时遇到问题Python 如何在PyGame中画一个圆?,python,pygame,draw,Python,Pygame,Draw,您好,我在绘制圆时遇到问题错误:模块对象没有属性“圆”。我做错了什么 还有,我怎样才能把数字圈起来 例如:(第一次单击为0的圆,第二次单击为1的圆,依此类推) 您键入的函数名称错误。正确的名字是 def drawCircle(): pos=getPos() pygame.draw.circle(屏幕,蓝色,位置,20)#此处输入您绘制的圆圈数计数器,并使用与圆圈中心相同的坐标书写数字。 另外,命令是pygame.draw.circle,而不是pygame.draw.circl import py
错误:模块对象没有属性“圆”
。我做错了什么
还有,我怎样才能把数字圈起来
例如:(第一次单击为0的圆,第二次单击为1的圆,依此类推)
您键入的函数名称错误。正确的名字是
def drawCircle():
pos=getPos()
pygame.draw.circle(屏幕,蓝色,位置,20)#此处输入您绘制的圆圈数计数器,并使用与圆圈中心相同的坐标书写数字。
另外,命令是pygame.draw.circle,而不是pygame.draw.circl
import pygame
pygame.init()
screen = pygame.display.set_mode((x, y)) #x and y are height and width
pygame.draw.circle(screen, (r,g,b), (x, y), R, w) #(r, g, b) is color, (x, y) is center, R is radius and w is the thickness of the circle border.
以下是正确绘制圆的方法
import pygame
window = pygame.display.set_mode((500,500))
red = (200,0,0)
circleX = 100
circleY = 100
radius = 10
active = True
while active:
for event in pygame.event.get():
if event.type == pygame.QUIT:
active = False
pygame.draw.circle(window,red,(circleX,circleY),radius) # DRAW CIRCLE
pygame.display.update()
import pygame
pygame.init()
screen = pygame.display.set_mode((x, y)) #x and y are height and width
pygame.draw.circle(screen, (r,g,b), (x, y), R, w) #(r, g, b) is color, (x, y) is center, R is radius and w is the thickness of the circle border.
import pygame
window = pygame.display.set_mode((500,500))
red = (200,0,0)
circleX = 100
circleY = 100
radius = 10
active = True
while active:
for event in pygame.event.get():
if event.type == pygame.QUIT:
active = False
pygame.draw.circle(window,red,(circleX,circleY),radius) # DRAW CIRCLE
pygame.display.update()