py_clocks
The py_clocks
package is a Python-based project designed for displaying multiple timezone clocks on a Windows desktop.
By default, the app shows the time in the following timezones: - Asia/Tokyo - Asia/Kolkata - Europe/Berlin
Screenshot of the py_clocks
application showing multiple timezone clocks.
Building and Running the Project
.venv/Scripts/python.exe packages/py_clocks/src/py_clocks/py_clocks.py
Creating an Executable
To create a standalone executable for the py_clocks
package using PyInstaller, use the provided script:
pyinstaller --onefile packages/py_clocks/src/py_clocks/py_clocks.py
Locate the executable: The generated executable will be located in the dist
directory as py_clocks.exe
.
source manual
PyClocks()
A class that encapsulates the clock application logic and individual clock widgets.
Initializes the PyClocks application.
add_clock_widget(timezone, label_text, bg_color, text_color)
Adds a clock widget to the application window.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
timezone
|
str
|
The timezone for the clock. |
required |
label_text
|
str
|
The label text displayed above the clock. |
required |
bg_color
|
str
|
The background color of the widget. |
required |
text_color
|
str
|
The text color for the labels. |
required |
configure_window()
Configures the main application window and positions it at the bottom-right corner of the screen.
run()
Runs the PyClocks application by creating the main window and adding clock widgets for specified timezones.
start_clock_update(time_label, date_label, timezone, label_text)
Starts the periodic update of the clock display.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
time_label
|
CTkLabel
|
The label to update with the current time. |
required |
date_label
|
CTkLabel
|
The label to update with the current date. |
required |
timezone
|
str
|
The timezone for the clock. |
required |
label_text
|
str
|
The label text for logging purposes. |
required |