Yea, I know even the Title of this question is confusing. Sorry but that is the best I can describe what I am trying to accomplish.
So.... I am still learning to work with Python classes. Here is one that I need some help with. Basically I have a single Class that I create a stopwatch with. Then I have a bunch of functions outside of that class that do other tasks and I have my Main function. I need to be able to start and stop my stopwath class instance from one of the non-class functions. Here a slimmed down version so you can see my structure.
class StopWatch(Frame):
...
def Start(self):
...
def Start(self):
...
def dosomething():
# right here I want to call the sw1.Start function in StopWatch.
def dosomethingelse();
# right here I want to call the sw1.Stop function in StopWatch.
def main():
sw1 = StopWatch(root)
I have tried to do something like this but it doesn't work.
class StopWatch(Frame):
...
def Start(self):
...
def Start(self):
...
def dosomething():
# right here I want to call the sw1.Start function in StopWatch.
tmp = StopWatch
tmp.Start()
def dosomethingelse();
# right here I want to call the sw1.Stop function in StopWatch.
tmp = StopWatch
tmp.Start()
def main():
sw1 = StopWatch(root)
I am sure this doesn't work because I it is not the sw1 instance of the StopWatch class.
So how can I call the Start and Stop functions of the StopWatch class for instance sw1?