-
Notifications
You must be signed in to change notification settings - Fork 131
Feat/digital clock improvements #114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
15f2d8d
db19bc8
0173fc9
026b56e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,23 +1,50 @@ | ||||||
| from time import strftime | ||||||
| from tkinter import Label, Tk | ||||||
| from tkinter import Label, Tk , Button | ||||||
|
|
||||||
| window = Tk() | ||||||
| window.title("Digital Clock") | ||||||
| window.geometry("300x100") | ||||||
|
||||||
| window.geometry("300x100") | |
| window.geometry("300x180") |
Copilot
AI
Sep 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using both place() and pack() geometry managers in the same window can cause layout conflicts. The clock_label uses place() while date_label and fmt_btn use pack(). Consider using a consistent geometry manager throughout.
| clock_label.place(x=50, y=50) | |
| clock_label.pack(pady=(10, 0), anchor="center") |
Copilot
AI
Sep 25, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using lstrip('0') removes all leading zeros from the entire string, which could incorrectly strip zeros from minutes or seconds (e.g., '10:05:02' becomes '1:5:2'). Use strftime('%#I:%M:%S %p') on Windows or strftime('%-I:%M:%S %p') on Unix systems to remove only the leading zero from hours.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The calculation includes the current day (
localtime.tm_mday) which represents a partial day, but then multiplies by 24 hours as if it were complete days. This creates inaccurate hour/minute/second calculations. Consider excluding the current partial day or adjusting the calculation to account for the actual time of day.