I just wrote a small text class in python for a game written using pygame and for some reason my default arguments aren't working. I tried looking at the python documentation to see if that might give me an idea what I did wrong, but I didn't fully get the language in the documentation. No one else seems to be having this issue.
Here's the code for the text class:
class Text:def __init__(self,screen,x_location='center',y_location='center',writeable,color,size=12):self.font = pygame.font.Font("Milleni Gem.ttf", size)self.text = self.font.render(writeable,True,color)self.textRect = self.text.get_rect()if x_location == "center":self.textRect.centerx = screen.get_rect().centerxelse:self.textRect.x = x_locationif y_location == "center":self.textRect.centery = screen.get_rect().centeryelse:self.textRect.y = y_locationself.update()def update(self):screen.blit(self.text,self.textRect)
and here's the code to call it:
from gui import *
Text(screen,75,75,currentweapon.clip)#currentweapon.clip is an integer
The error I get is this:
SyntaxError: non-default argument follows default argument
and points to the def __init__()
line in the code. What does this error mean and what am I doing wrong here?