Hi,
I have a doubt about python and I would like to ask it to you.
It is about the use of functions -methos- of a class within other
class. I have 2 classes in 2 separate files, in file squares.py I
have the class Square with the methods getRect() and setRect().
Now, in other file, board.py, I have the class Board that has an
object outskirt= Square(), can anyone tell me how do I have to use
the method setRect ?
The code is the following:
File squares.py
class Square:
def setRect(self, x,y,width,height):
self.rect= pygame.rect(x,y,width, height)
File board.py
from squares import Square
import squares
class Board :
for i in range(42):
self.outskirt.append(squares.Square(self))
def squareConfiguration (self):
...
for j in range(len(self.outskirt)):
#and now is when I don't know which I have to use to do it OK :
self.outskirt[j].rect= pygame.rect ( x, y, w, h)
self.outskirt[j].setRect( x, y, w, h)
Square.setRect( self.outskirt[j], x, y, w, h)
I haven't proved them because I'm quite lost using python...
Thanks and sorry for my English..