You are browsing as a guest. Sign up (or log in) to start making projects!

1h 43m 52s logged

Welcome to my second log for Timed.

Timed is a hub for all your temporal needs. It has the basic features like a clock and timers, and I intend to add all sorts of different things like moon phases, solar events, and way more.

Right now, it is a Python file with an audio file so it can run an alert sound, but I intend to make this a Python Flask web app. In this log, I added the following:

The code currently uses four libraries:

  1. The existing time module inside of Python
  2. The datetime library
  3. The playsound library
  4. msvcrt

We have two functions:

  1. Timer function: It takes two parameters: the time length in seconds and the direction the timer is going (up or down).
  2. Infinite loop function: It checks if any keys are pressed using the msvcrt library. If so, it breaks out of the loop. If not, it uses the datetime library to get the current time, prints it, waits one second, and prints it again.

This entire while loop is inside a try-except block. If a KeyboardInterrupt error is seen, it prints “Clock stopped.”

We have a variable set to an input to see if the user is going to use the timer or the live clock. If they choose the timer, we ask them for the direction (up or down) and if they will be using minutes. The following code then calls for those parameters.

0
5

Comments 0

No comments yet. Be the first!