fbpx

CS-Lab Support Forum for CNC Community

Help to run this brand-new forum and stay with us.
Ask your questions, we are here to help! 

 

Please or Register to create posts and topics.

countdown timer python console

Hello, when I print the following countdown timer in the Python console, it writes to a new line every second, despite the fact that I have formatted the print statement with \r. Is it intentional that no line should be overwritten in the Python console or is it something else? It is the countdown timer for my spindle warm-up.

#Definition countdown timer
def countdown(minutes):
seconds = minutes * 60
while seconds > 0:
mins, secs = divmod(seconds, 60)
timer = '{:02d}:{:02d}'.format(mins, secs)
print(timer, end="\r")
time.sleep(1)
seconds -= 1

Uploaded files:
  • Screenshot-2024-01-04-141346.png

I'm not sure of anything but I don't think you can delete text in a "debug" window

the option would be to open a window for your timer

 

add this line in you code

 

https://github.com/erwan56450/SimCnC/blob/main/tests/timer_for_spindel.py

Hello,

I've passed the issue on to our developer, and he will check if we can do anything about it.

The report received number ticket #585, you can refer to this number in the future.

Hello erwan, I don't understand the python console as a debug window but as a general display console. Well let's see what the developers say, it's already been forwarded.
Thanks in advance to the support.

erwan has reacted to this post.
erwan

PARTNERS:

 

USA

Germany

Slovenia / Bosnia

Spain

South Africa

UNI-CAM

The Netherlands

Portugal

Greece

  Distrib milionis logo

Hungary

Distrib logot

Bulgaria

Master

Kenya

Proteq Automation

Egypt

Germanelectronix

China

Jun Ma

Serbia

ALCO

Italy

LVL tech r

Denmark

Varntoft Dania

Finland

×

Hello!

Click one of our contacts below to chat on WhatsApp

× How can I help you?