-3

I want to make a application in which there are two buttons(say click & ok) and a text box.I want to generate waiting time between clicking on two buttons and display in text box.

For Example:- If I first click on CLICK Button and wait for few seconds/minutes then click on OK Button. Then this waiting time should be displayed on text box.

Please help me. Thanks in advance

Virus
  • 61
  • 1
  • 7

1 Answers1

1

This is very simple to do with Glade Interface Designer. import time then, create a variable self.timer = None.

Then when Click's event is raised simply state something like: self.timer = time.time().

When OK's event is raised, write to the TextBox: str((time.time()-self.timer)).

This worked for me. If you aren't using glade, you can still use the same concept after you create your GUI.


See Also - Python - time.clock() vs. time.time() - accuracy?


If you are asking how to code everything (including the GUI) in wxPython, I would suggest looking at some tutorials first.

Community
  • 1
  • 1
Jordan Carroll
  • 696
  • 2
  • 11
  • 29