CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/pypi-asciimatics

tessl install tessl/pypi-asciimatics@1.15.0

A cross-platform package to replace curses (mouse/keyboard input & text colours/positioning) and create ASCII animations

Agent Success

Agent success rate when using this tile

81%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.33x

Baseline

Agent success rate without this tile

61%

task.mdevals/scenario-5/

User Registration Form

Build a simple terminal-based user registration form that collects and validates user information.

Requirements

Create a registration form with the following input fields:

  • Username (alphanumeric only, 3-20 characters)
  • Email address (must contain @ and a domain)
  • Password (hidden input, minimum 6 characters)
  • Confirm password (hidden input, must match password)

The form should:

  • Display all fields with appropriate labels
  • Provide a "Submit" button that validates all inputs
  • Provide a "Cancel" button that exits the form
  • Show validation errors when submission fails
  • Exit successfully when all validations pass

Validation Rules

  1. Username must be 3-20 characters long and contain only letters, numbers, and underscores
  2. Email must be in a valid format (contain @ and at least one dot after @)
  3. Password must be at least 6 characters long
  4. Confirm password must exactly match the password field

Test Cases

  • When username is "ab" (too short), validation should fail @test
  • When email is "invalid.email" (missing @), validation should fail @test
  • When password is "pass" (too short), validation should fail @test
  • When passwords don't match, validation should fail @test
  • When all fields are valid, form should submit successfully @test

Implementation

@generates

API

from asciimatics.widgets import Frame, Layout, Text, Button
from asciimatics.scene import Scene
from asciimatics.exceptions import StopApplication, InvalidFields

class RegistrationForm(Frame):
    """Terminal-based user registration form with validation"""

    def __init__(self, screen):
        """
        Initialize the registration form.

        Parameters:
        - screen: The Screen object to render the form on
        """
        pass

    def _on_submit(self):
        """
        Handle form submission with validation.
        Raises InvalidFields if validation fails.
        Raises StopApplication if validation succeeds.
        """
        pass

    def _on_cancel(self):
        """Handle form cancellation"""
        pass

def demo(screen):
    """
    Demo function to display the registration form.

    Parameters:
    - screen: The Screen object to render on
    """
    pass

Dependencies { .dependencies }

asciimatics { .dependency }

Provides terminal UI widgets and form management.

@satisfied-by

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/asciimatics@1.15.x
tile.json