Reputation:
I am receiving this error when trying to do division
roomRatio = max(self.getRoomWidth(), self.getRoomHeight)/8
TypeError: unsupported operand type(s) for /: 'instancemethod' and 'int'
getRoomWidth/Height()
returns integer sizes of the room I am in.
Upvotes: 0
Views: 2385
Reputation: 213368
You forgot ()
.
roomRatio = max(self.getRoomWidth(), self.getRoomHeight())/8
^^
Note that in Python, you usually don't need setX()
or getX()
methods, because you can do this instead:
class MyClass(object):
def getRoomWidth(self):
...
def setRoomWidth(self, width);
...
roomWidth = property(getRoomWidth, setRoomWidth)
And to use it,
self.width = self.width * 2
Upvotes: 3