Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Update DigitalClock.py #477

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

Open
Om149 wants to merge 1 commit into DhanushNehru:main
base: main
Choose a base branch
Loading
from Om149:patch-3
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 22 additions & 13 deletions Digital Clock/DigitalClock.py
View file Open in desktop
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
import tkinter
import tkinter as tk
from time import strftime

top = tkinter.Tk()
top.title('Digital Clock')
# 0,0 makes the window non-resizable
top.resizable(0,0)
# Create main window
top = tk.Tk()
top.title('🕒 Digital Clock')
Copy link
Preview

Copilot AI Aug 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Using emojis in window titles may cause display issues on some operating systems or environments that don't support Unicode properly. Consider using plain text for better compatibility.

Suggested change
top.title('🕒 Digital Clock')
top.title('Digital Clock')

Copilot uses AI. Check for mistakes.

top.geometry('500x150')
top.resizable(0, 0)
top.configure(bg='#1e1e2f') # Dark background

# Function to update time
def time():
# %p defines AM or PM
string = strftime('%H: %M: %S %p')
clockTime.config(text=string)
clockTime.after(1000, time)
string = strftime('%I:%M:%S %p') # 12-hour format with AM/PM
Copy link
Preview

Copilot AI Aug 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment mentions 'AM/PM' but the format string '%I:%M:%S %p' will display AM/PM at the end. However, the original code used '%H: %M: %S %p' which mixed 24-hour format (%H) with AM/PM (%p), which doesn't make sense. The new format is correct, but the original logic suggests 24-hour format was intended.

Copilot uses AI. Check for mistakes.

clock_label.config(text=string)
clock_label.after(1000, time)

clockTime = tkinter.Label(top, font=('courier new', 40),
background='red',foreground='black')
clockTime.pack(anchor='center')
# Digital clock label styling
clock_label = tk.Label(top, font=('Segoe UI', 48, 'bold'),
background='#1e1e2f',
foreground='#00FFCC',
padx=20, pady=20)
clock_label.pack(anchor='center', expand=True)

# Start clock
time()
top.mainloop()

# Start the main loop
top.mainloop()

AltStyle によって変換されたページ (->オリジナル) /