我正在創建一個程序,如果光標位置的像素還不是黑色,我會嘗試在光標位置繪制一個矩形。if pygame.Surface.get_at(pygame.mouse.get_pos()) != (0,0,0,255): pygame.draw.rect(win, (0,0,0), (x, y, 3, 3))當我嘗試實現 pygame.Surface.get_at() 時發生錯誤,它說...TypeError: descriptor 'get_at' for 'pygame.Surface' objects doesn't apply to a 'tuple' object.. 即使 pygame.Surface.get_at() 在https://pygame.org上的文檔顯示該方法的輸入應該是一個元組。get_at() get the color value at a single pixel get_at((x, y)) -> Color Return a copy of the RGBA Color value at the given pixel. If the Surface has no per pixel alpha, then the alpha value will always be 255 (opaque). If the pixel position is outside the area of the Surface an IndexError exception will be raised.我怎樣才能解決這個問題?
“pygame.Surface”對象的描述符“get_at”不適用于“元組”對象
12345678_0001
2023-03-16 17:16:03
