import pygame, sys, time, random
from pygame.locals import*
pygame.init()
class Button(object):
def __init__(self, x, y):
'''x_size, y_size,'''
#self.name = name
'''self.length = x_size'''
'''self.height = y_size'''
self.xpos = x
self.ypos = y
self.rect = (100,100)
self.image = ('Images\Button_Test.png')
def getRect(self):
return self.rect
def onClick():
for event in pygame.event.get():
if event.type == pygame.mouse.get_pressed():
pos = pygame.mouse.get_pos()
if self.collidepoint(pos):
return
主班
screen.blit(background,(0,0))
screen.blit(testButton, testButton.getRect())
pygame.display.flip()
TypeError:参数 1 必须是 pygame.Surface,而不是 Button
谁能帮我解决这个错误?