Good Site on Classes

Alex alex at somewhere.round.here
Mon Mar 20 13:26:26 EST 2000


> Well.. Let say that I have a class called GetInfo(), and a another
> class called DisplayInfo(). With in that class i have a function
> called UpdateDisplay().
> 
> Now I want to call the DisplayInfo.UpdateDisplay() with in GetInfo().

You could pass DisplayInfo as an argument to GetInfo:

class GetInfo:
    def __init__ (self, DisplayInfo):
        self.DisplayInfo = DisplayInfo

    def Update (self):
        self.DisplayInfo.UpdateDisplay ()

display=DisplayInfo()
info=GetInfo(display)

info.Update ()

Does that do the trick?

Alex.



More information about the Python-list mailing list