Jan-22-2019, 02:59 PM
I have been working for days now trying to implement a timer, which would take 5 minutes in any other language. I have tried every tutorial in existence and none of them work. I am now on my last nerve and I just do not understand why calling a function in python is so difficult. Below is a snippet of code that demonstrates my problem.
In the example, the function runs fine when called from another function in the class.
Likewise, "self.updateDebugger" is another function (not shown) in the class and calling it seems to be just fine. But if I try to schedule the code using a clock, I get an error stating "AttributeError: 'float' object has no attribute 'updateDebugger'"
In the example, the function runs fine when called from another function in the class.
Likewise, "self.updateDebugger" is another function (not shown) in the class and calling it seems to be just fine. But if I try to schedule the code using a clock, I get an error stating "AttributeError: 'float' object has no attribute 'updateDebugger'"
class MainWindow(App): def clockFunc(self): self.updateDebugger("data read @ " + datetime.datetime.now()) print ("doing stuff") Clock.schedule_interval(clockFunc, .5) if __name__ == '__main__': MainWindow().run()The error "AttributeError: 'float' object has no attribute 'updateDebugger'" I assume is referring to the clock not being able to pass an argument as a a float. Why the clock needs to do such a thing I have no idea. I also dont understand what this has to do with "self.updateDebugger" since this method has nothing to do with the clock. The clock is scheduling the clockFunc() function. If the code runs fine when being called then why can't the clock run the code?