- Posts: 2419
- Thank you received: 0
Display program time / cyclus time in custom gui, how to example
7 years 9 months ago #123356
by Grotius
Hi,
This tiny doc is for the python coded gui's / user interfaces :
dependencies : import time
in init section :
self.start = False
self.start_time = 0
self.end_time = 0
behind start button :
self.start = True
self.start_time = time.time()
behind stop button :
self.start = False
self.end_time = time.time()
in periodic section :
if self.start == True:
self.widgets.program_time.set_text('%.2f' %(float(time.time() - self.start_time)/60) )
if not self.start == True:
self.widgets.program_time.set_text('%.2f' %(float(self.end_time - self.start_time)/60) )
The result is a output text of 2 decimal's, this is fabricated with '%.2f' %
3f will output 3 decimal's and so on.
Displaying current loaded file :
Add a label, for example label "program_name"
In python add a line, i did this in periodic section :
self.widgets.program_name.set_text("program :" + self.s.file)
And it will display your current loaded program, this is very handy.
This tiny doc is for the python coded gui's / user interfaces :
dependencies : import time
in init section :
self.start = False
self.start_time = 0
self.end_time = 0
behind start button :
self.start = True
self.start_time = time.time()
behind stop button :
self.start = False
self.end_time = time.time()
in periodic section :
if self.start == True:
self.widgets.program_time.set_text('%.2f' %(float(time.time() - self.start_time)/60) )
if not self.start == True:
self.widgets.program_time.set_text('%.2f' %(float(self.end_time - self.start_time)/60) )
The result is a output text of 2 decimal's, this is fabricated with '%.2f' %
3f will output 3 decimal's and so on.
Attachment not found
Displaying current loaded file :
Add a label, for example label "program_name"
In python add a line, i did this in periodic section :
self.widgets.program_name.set_text("program :" + self.s.file)
And it will display your current loaded program, this is very handy.
Please Log in to join the conversation.
7 years 9 months ago #123379
by BigJohnT
Replied by BigJohnT on topic Display program time / cyclus time in custom gui, how to example
Please Log in to join the conversation.
Time to create page: 0.085 seconds
