[Tutor] Passing count from one function to another

Gregor Lingl glingl@aon.at
Mon Feb 24 11:43:01 2003


Deirdre Hackett schrieb:

>class Application(Frame):
>
              def __init__(self):
                  self.count = 0       

>
>            def move(self,x,y,z):
>                    ................
>
>            def graph(self,x,y,z):
>                    ..................
>                    ..................
>                    if (self.count==20):   # count --> self.count
>                        self.count = 0     # detto
>                        self.move()
>
>
>            def start_input(self):
>                    ..................
>                    ..................
>
>                    self.take_reading()
>
>            def take_reading(self):
>
>                    ..................
>                    ..................
>
                      self.count += 1                     

>                    self.reading(reading[0], reading[1], reading[2])
>                    t = Timer(0, self.take_reading)
>                    t.start()
>
>
>This is basically the skeleton of the program. I want to initialise a count
>and count how many times take reading is called and then when graph is
>called the count value is also passed to it and then when count is equal to
>20 then move is called.
>I know this is probably a very basic "programming" problem.
>I don't think i have defined it very clearly but would greatly appreciate
>any help as I am so close to wrapping this whole thing up.
>Thanks
>Deirdre
>
>  
>
HTH, Gregor


>_______________________________________________
>Tutor maillist  -  Tutor@python.org
>http://mail.python.org/mailman/listinfo/tutor
>
>
>  
>