Skip to content

digital_clock

pdwidgets.widgets.digital_clock

Live digital clock label.

DigitalClock(parent, x=0, y=0, w=None, h=None, align=None, align_to=None, fg=None, bg=None, visible=True, value=None, padding=None, text_height=TEXT_SIZE.LARGE, scale=1)

Bases: Label

Live-updating HH:MM:SS clock label.

Initialize a DigitalClock widget to display the current time.

Parameters:

Name Type Description Default
parent Widget

The parent widget or screen that contains this digital clock.

required
x int

The x-coordinate of the digital clock.

0
y int

The y-coordinate of the digital clock.

0
w int

The width of the digital clock.

None
h int

The height of the digital clock.

None
align int

The alignment of the digital clock.

None
align_to Widget

The widget to align to.

None
fg int

The color of the digital clock.

None
bg int

The background color of the digital clock.

None
visible bool

The visibility of the digital clock.

True
value str

The initial value of the digital clock.

None
padding tuple

The padding on each side of the digital clock.

None
text_height int

The height of the text (default is TEXT_SIZE.LARGE).

LARGE
scale int

The scale of the text (default is 1).

1
Usage

clock = DigitalClock(screen, text_height=TEXT_SIZE.LARGE, scale=2)

update_time()

Refresh the displayed time from the system clock.