Python Forum
[PyGame] TypeError: unsupported operand type(s) for -: 'int' and 'instancemethod'
Thread Rating:
  • 2 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyGame] TypeError: unsupported operand type(s) for -: 'int' and 'instancemethod'
#3
(Oct-05-2017, 05:45 PM)DeaD_EyE Wrote: In line 38 you define the attribute sneek_width without any effect, because it's not bound to the instance nor to the class. In line 44 you define a method sneek_width of the class snek. Later you try to divide an integer with an instance method. You've forgotten to call the instance method.

But from where comes get_width? It looks for me like brute force programing with copied and pasted code.

I'm really new to python, so I was following a tutorial about how to use collision detection, but I already had been writing my own code, so I tried to implement collision detection into my code based on the code in the tutorial. How do I bind it to the instance or class? How do I call the instance method? Sorry about the stupid questions. I'm a noob.
Reply


Messages In This Thread
RE: TypeError: unsupported operand type(s) for -: 'int' and 'instancemethod' - by SnekLover123 - Oct-05-2017, 06:18 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyGame] PLEASE HELP! TypeError: unsupported operand type(s) for +: 'pygame.Surface' and 'int' keyfive 1 5,357 Jun-19-2018, 01:20 PM
Last Post: volcano63

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020