I'm sorry if I come across as incredibly stupid, I'm relatively new to python and I can not figure out what I am doing wrong here.
I have two classes, and I try to get the class names of both with
*class*.__class__.__name__
Now, as I said, this works for one class, but doesn't for another.
These are my classes:
class fb():
val = 300
mult = 2.0
shsym = pygame.image.load('img/dummy2.png')
value = 50
class a():
occ = 0
shsym = pygame.image.load('img/it/a/shsym.png')
plsym = pygame.image.load('img/it/a/plsym.png')
value = 100
hesyms = [pygame.image.load('img/a/hesym0',pygame.image.load('img/dummy.png'))]
coord = [(50, 300),(30, 435),(310, 350)]
The variables inside probably don't really matter but as I can't figure out the problem I just included the whole thing.
Then I define them
fob = fb()
ita = a()
Then I set a variable as one of the defined classes
itemselect = fob
And then, finally, I try to check the class' name and look if it begins with 'f' (to see if it is part of a group of items)
if not itemselect.__class__.__name__.startswith("f"):
And in that line I get the error message
Traceback (most recent call last):
File "D:\Programmieren\Cola Atsume\main.py", line 283, in <module>
if not itemselect.__class__.__name__.startswith("f"):
AttributeError: class fa has no attribute '__class__'
When itemselect is ita everything works just fine, but with fob it doesn't. I know I could do this differently, and my whole class system isn't really conventional and all but I don't really want to change it if I don't have to.