[英]Got the error TypeError: execute() takes no keyword arguments
[英]Error: TypeError: circle() takes no keyword arguments
我正在嘗試創建一個游戲,其中包含一個需要在單擊某處后添加的圓圈,其他代碼行工作正常,它只是代碼行pygame.draw.circle(win, white, (105-circle_radius/2, 105-circle_radius/2), radius=circle_radius)
返回的錯誤為:
TypeError: circle() takes no keyword arguments
代碼:
import pygame
pygame.init()
white = (255, 255, 255)
player_details = []
circle_radius = 100
WIDTH = 500
HEIGHT = 500
win = pygame.display.set_mode((WIDTH, HEIGHT))
(irrelevant code here)
def insert_input(slot_num, marker):
board[slot_num] = marker
print(board)
def circle_placement(x, y):
if (31 <= x <= 179) and (31 <= y <= 179):
slot1 = 1
if board[1] == " ":
insert_input(slot1, player_details[1])
pygame.draw.circle(win, white, (105-circle_radius/2, 105-circle_radius/2), radius=circle_radius
if board[1] != " ":
print("Turn passed for attempting to Cheat!")
(irrelevant code here)
我嘗試了其他形狀並且一切正常,只是這個不起作用並返回錯誤:TypeError: circle() takes no keyword arguments,我試圖將“circle_radius”更改為數字而不是變量但這不起作用,我嘗試更改顏色但也不起作用。
我還沒有從 inte.net 上找到任何答案,從我的研究中,當我這樣做的時候,他們沒有工作,所以我希望在這里找到答案。
pygame.draw.circle()
的半徑參數不是關鍵字參數(刪除radius=
):
pygame.draw.circle(win, white, (105-circle_radius/2, 105-circle_radius/2), radius=circle_radius)
pygame.draw.circle(win, white, (105-circle_radius/2, 105-circle_radius/2), circle_radius)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.