CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-textual

Modern Text User Interface framework for building cross-platform terminal and web applications with Python

Overall
score

93%

Overview
Eval results
Files

task.mdevals/scenario-4/

Task Counter Application

Build a simple task counter TUI application that tracks completed and pending tasks using reactive programming.

Requirements

Create a terminal application that displays:

  • A count of completed tasks
  • A count of pending tasks
  • The total number of tasks
  • A label showing the completion percentage

The application should update all displays automatically when task counts change. When a user presses the 'c' key, it should increment the completed count. When a user presses the 'p' key, it should increment the pending count. Pressing 'q' should quit the application.

The completion percentage should be calculated automatically based on the completed and pending counts, formatted as "X.X%" (one decimal place). If there are no tasks, display "0.0%".

Implement this using reactive attributes that automatically update dependent values and trigger UI refreshes when changed.

@generates

API

"""Task counter application using reactive programming."""

from textual.app import App


class TaskCounterApp(App):
    """A TUI app that tracks task counts with reactive updates."""

    def compose(self):
        """Compose the UI widgets."""
        pass

Test Cases

  • When completed is 0 and pending is 0, the total should be 0 and percentage should be "0.0%" @test
  • When completed is 3 and pending is 2, the total should be 5 and percentage should be "60.0%" @test
  • When the 'c' key is pressed, the completed count should increment by 1 @test
  • When the 'p' key is pressed, the pending count should increment by 1 @test

Dependencies { .dependencies }

textual { .dependency }

Provides the TUI framework with reactive programming support.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/pypi-textual

tile.json