Ben Hack
Ben Hack

Reputation: 91

Tuple dictionary key not able to be retrieved

One problem goes, another comes- I've got another(probably just as obvious) problem:

'tuple' object is not callable

from

for a in range(current_view_y,current_view_y+60):
    for b in range(current_view_x,current_view_x+80):
        if (b,a) in unervise:
            screen.blit(Surface(unervise[(b,a)].color()))

I don't think this is actually related to the pygame code, just the other bit ( so I THINK screen to surface is ignore-able. (previous question with the dictionary generation code:here Once again I apologize for how obvious this probably is- but I simply can't see it (and I can't post it on the previous question). Most topics on this say a missing comma is to blame- but I only have one.

Upvotes: 0

Views: 60

Answers (1)

Martijn Pieters
Martijn Pieters

Reputation: 1123970

You are trying to use the .color attribute of your block class as a method, but it is a tuple:

screen.blit(Surface(unervise[(b,a)].color()))

Remove the surplus ():

screen.blit(Surface(unervise[(b,a)].color))

Upvotes: 2

Related Questions