Skip to content

textual_countdown.countdown

Provides a visual countdown widget.

Countdown

Countdown(name=None, id=None, classes=None, disabled=False)

Bases: Widget

A countdown widget.

Parameters:

Name Type Description Default

name

str | None

The name of the countdown widget.

None

id

str | None

The ID of the countdown widget in the DOM.

None

classes

str | None

The CSS classes of the countdown widget.

None

disabled

bool

Whether the countdown widget is disabled or not.

False

COMPONENT_CLASSES class-attribute instance-attribute

COMPONENT_CLASSES = {'countdown--remaining'}
Class Description
countdown--remaining Targets the remaining portion of the countdown display.

is_running property

is_running

Is the countdown currently running?

Cancelled dataclass

Cancelled(countdown)

Bases: CountdownMessage

Message sent if the countdown is cancelled.

CountdownMessage dataclass

CountdownMessage(countdown)

Bases: Message

Base class for the Countdown message classes.

control property

control

An alias for countdown.

countdown instance-attribute

countdown

The Countdown widget that sent the message.

Finished dataclass

Finished(countdown, counting)

Bases: Timed

Message sent when the countdown finishes.

Started dataclass

Started(countdown, counting)

Bases: Timed

Message sent when the countdown starts.

Timed dataclass

Timed(countdown, counting)

Bases: CountdownMessage

Base class for messages that include a time value.

counting instance-attribute

counting

The amount being counted.

cancel

cancel()

Cancel the countdown timer from running.

Note

When the countdown is cancelled a Cancelled message is posted.

start

start(countdown)

Start a countdown.

Parameters:

Name Type Description Default

countdown

float

The amount of time to count down.

required
Note

When the countdown starts a Started message is posted.