Skip to main content

PyPI - Version PyPI - Python Version GitHub Actions Workflow Status codecov Framework: Textual

Textual Timepiece

Various time management related widgets for the Textual framework.

Documentation | Changelog | PyPi

Included Widgets
Pickers Description
DatePicker A visual date picker with an input and overlay.
DurationPicker Visual duration picker with duration up to 99 hours.
TimePicker Visual time picker for setting a time in a 24 hour clock.
DateTimePicker Datetime picker that combines a date and time.
DateRangePicker Date range picker for picking an interval between two dates.
DateTimeRangePicker Range picker for picking an interval between two times.
DateTimeDurationPicker Pick an interval between two times, including a duration input.
Activity Heatmap Description
ActivityHeatmap Activity Heatmap for displaying yearly data similar to the GitHub contribution graph.
HeatmapManager Widget for browsing the Activity Heatmap with yearly navigation builtin.
Timeline Description
HorizontalEntry Horizontal entry for a horizontal timeline layout.
HorizontalRuler Horizontal ruler for marking horizontal timelines.
HorizontalTimeline Basic timeline widget that displays entries in a horizontal view.
HorizontalTimelineNavigation Horizontal widget containing a horizontal timeline and header.
RuledHorizontalTimeline Ruled horizontal timeline with markers.
RuledVerticalTimeline Ruled vertical timeline with markers.
VerticalEntry Vertical entry for a vertical timeline layout.
VerticalRuler Vertical ruler for marking vertical timelines.
VerticalTimeline Basic timeline widget that displays entries in a vertical view.
VerticalTimelineNavigation Vertical widget containing a vertical timeline and header.
Selector Description
DateSelect Date selection widget with calendar panes.
TimeSelect Time selection widget with various times in 30 minute intervals.
DurationSelect Duration selection widget with modifiers for adjust time or duration.
Input Description
DateInput Date input which takes in a iso-format date.
TimeInput Time input that takes in 24 hour clocked in a HH:MM:SS format.
DurationInput Duration input with a duration up to 99 hours.
DateTimeInput An input with a combination of a date and time in iso-format.

Demo

UVX

uvx textual-timepiece

PIPX

pipx run textual-timepiece

Install

Pip

pip install textual-timepiece

UV

uv add textual-timepiece

Poetry

poetry add textual-timepiece

[!NOTE] Requires whenever as an additional dependency.

Quick Start

DatePicker

Code
from textual.app import App, ComposeResult
from textual_timepiece.pickers import DatePicker
from whenever import Date

class DatePickerApp(App[None]):
    def compose(self) -> ComposeResult:
        yield DatePicker(Date(2025, 3, 4))

if __name__ == "__main__":
    DatePickerApp().run()
Result

DateTimePicker Example

DateTimePicker

Code
from textual.app import App, ComposeResult
from textual_timepiece.pickers import DateTimePicker
from whenever import ZonedDateTime

class DateTimePickerApp(App[None]):
    def compose(self) -> ComposeResult:
        yield DateTimePicker(ZonedDateTime.from_system_tz(2025, 3, 4, 9, 42, 47)))


if __name__ == "__main__":
    DateTimePickerApp().run()
Result

DatePicker Example

ActivityHeatmap

Code
import random
from collections import defaultdict

from textual.app import App, ComposeResult
from textual_timepiece.activity_heatmap import ActivityHeatmap, HeatmapManager


class ActivityApp(App[None]):
    def _on_heatmap_manager_year_changed(
        self,
        message: HeatmapManager.YearChanged,
    ) -> None:
        message.stop()
        self.set_heatmap_data(message.year)

    def retrieve_data(self, year: int) -> ActivityHeatmap.ActivityData:
        """Placeholder example on how the data could be generated."""
        random.seed(year)
        template = ActivityHeatmap.generate_empty_activity(year)
        return defaultdict(
            lambda: 0,
            {
                day: random.randint(6000, 20000)
                for week in template
                for day in week
                if day
            },
        )

    def set_heatmap_data(self, year: int) -> None:
        """Sets the data based on the current data."""
        self.query_one(ActivityHeatmap).values = self.retrieve_data(year)

    def _on_mount(self) -> None:
        self.set_heatmap_data(2025)

    def compose(self) -> ComposeResult:
        yield HeatmapManager(2025)


if __name__ == "__main__":
    ActivityApp().run()
Result

ActivityHeatmap Example

  • More examples can be found here

License

MIT. Check LICENSE for more information.

Metadata

Release files for textual-timepiece 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for textual-timepiece 0.7.0
File Size Uploaded
textual_timepiece-0.7.0.tar.gz 423.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for textual-timepiece 0.7.0
File Interpreter ABI Platform
textual_timepiece-0.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 482.8 kB

Release files / textual_timepiece-0.7.0.tar.gz

Download URL textual_timepiece-0.7.0.tar.gz
Size 423.6 kB
Tags Source
SHA-256 checksum
How to use checksums
be1a3388faa6936df96543597391b721fd340350f7a9cb2ad6904af7d4c77da8
BLAKE2b-256 checksum
How to use checksums
c957a437128c61c32e989afa73eb51bf144f6537b24dca6b0bfc69223a382199
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / textual_timepiece-0.7.0-py3-none-any.whl

Download URL textual_timepiece-0.7.0-py3-none-any.whl
Size 59.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2efe16ad270f74407e6241d345e46423ec1319295447e8c0885925bf39851d77
BLAKE2b-256 checksum
How to use checksums
48373cc0dc1156223d2cb5b0808d0ee68ad250479af0bf03908c93f6bf25011a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.7.0 This release

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page