### Install pre-commit and install git hook Source: https://github.com/domdfcoding/whiptail/blob/master/doc-source/contributing.rst Install the pre-commit tool using pip and then install the git hook to enforce code quality checks. ```bash python -m pip install pre-commit pre-commit install ``` -------------------------------- ### Python Example Script for Whiptail Source: https://github.com/domdfcoding/whiptail/blob/master/doc-source/example.rst This script demonstrates how to use whiptail to create various interactive dialog boxes. Ensure whiptail is installed on your system. ```python from whiptail import Whiptail whiptail = Whiptail() # Simple message box whiptail.message("Hello World", "This is a simple message box.") # Yes/No confirmation if whiptail.yesno("Confirm Action", "Do you want to proceed?"): print("User confirmed.") else: print("User cancelled.") # Input box name = whiptail.inputbox("Enter Your Name", "What is your name?", "John Doe") print(f"Entered name: {name}") # Password box password = whiptail.passwordbox("Enter Password", "Please enter your password:") print(f"Entered password: {password}") # Menu selection options = { "1": "Option 1", "2": "Option 2", "3": "Option 3" } choice = whiptail.menu("Select an Option", "Choose one of the following:", options) print(f"User selected: {choice}") # Checklist selection checklist_options = { "1": "Item A", "2": "Item B", "3": "Item C" } selected_items = whiptail.checklist("Select Items", "Choose multiple items:", checklist_options) print(f"Selected items: {selected_items}") # Radiolist selection radiolist_options = { "1": "Radio A", "2": "Radio B", "3": "Radio C" } selected_radio = whiptail.radiolist("Choose One", "Select a single option:", radiolist_options) print(f"Selected radio button: {selected_radio}") # Gauge (progress bar) whiptail.gauge("Processing", "Please wait...", 100) print("Gauge finished.") # Textbox display long_text = "This is a very long text that will be displayed in a textbox. It demonstrates how whiptail can handle multi-line content." whiptail.textbox("Long Text", long_text) # Infobox (non-interactive message) whiptail.infobox("Information", "This is an informational message that cannot be dismissed until complete.", 5) # Error box whiptail.error("Error Occurred", "An unexpected error has happened.") # If you want to use a specific tput command, you can pass it: # whiptail.message("Custom Tput", "Using a custom tput command.", tput="dialog") ``` -------------------------------- ### Install pre-commit and Git Hooks Source: https://github.com/domdfcoding/whiptail/blob/master/CONTRIBUTING.rst Install the pre-commit tool and its git hooks to maintain code quality. This is a prerequisite for other development tasks. ```bash $ python -m pip install pre-commit $ pre-commit install ``` -------------------------------- ### Install whiptail-dialogs with pip Source: https://github.com/domdfcoding/whiptail/blob/master/README.rst Install the whiptail-dialogs library using pip. Ensure you have Python installed. ```bash python -m pip install whiptail-dialogs ``` -------------------------------- ### Install whiptail package on Debian/derivatives Source: https://github.com/domdfcoding/whiptail/blob/master/README.rst Install the system-level whiptail package required by the Python library. This command is specific to Debian-based Linux distributions. ```bash apt-get install whiptail ``` -------------------------------- ### Clone Whiptail Repository Source: https://github.com/domdfcoding/whiptail/blob/master/doc-source/Source.rst Use this command to clone the whiptail source code from GitHub if you have git installed. ```bash git clone https://github.com/domdfcoding/whiptail ``` -------------------------------- ### Build documentation locally Source: https://github.com/domdfcoding/whiptail/blob/master/doc-source/contributing.rst Build a local copy of the project documentation using Sphinx, executed via tox. ```bash tox -e docs ``` -------------------------------- ### Build Documentation Locally with Tox Source: https://github.com/domdfcoding/whiptail/blob/master/CONTRIBUTING.rst Build a local copy of the project's documentation using Sphinx. This is achieved by running tox with the 'docs' environment. ```bash $ tox -e docs ``` -------------------------------- ### Build Whiptail with Tox Source: https://github.com/domdfcoding/whiptail/blob/master/doc-source/Source.rst The recommended method to build whiptail is by using tox. The source and wheel distributions will be located in the 'dist' directory after execution. ```bash tox -e build ``` -------------------------------- ### Run complete autoformatting suite Source: https://github.com/domdfcoding/whiptail/blob/master/doc-source/contributing.rst Execute the entire autoformatting suite using pre-commit to apply all configured code style checks and fixes. ```bash pre-commit run -a ``` -------------------------------- ### Run Complete Autoformatting Suite Source: https://github.com/domdfcoding/whiptail/blob/master/CONTRIBUTING.rst Execute the entire autoformatting suite using pre-commit. This command applies all configured formatters to the codebase. ```bash $ pre-commit run -a ``` -------------------------------- ### Run formate code formatting Source: https://github.com/domdfcoding/whiptail/blob/master/doc-source/contributing.rst Manually run the formate code formatter using pre-commit to ensure consistent code style. ```bash pre-commit run formate -a ``` -------------------------------- ### Run Formate Code Formatter Source: https://github.com/domdfcoding/whiptail/blob/master/CONTRIBUTING.rst Manually run the Formate code formatter using pre-commit to ensure consistent code style. Use the -a flag to apply all formatting rules. ```bash $ pre-commit run formate -a ``` -------------------------------- ### Run All Tox Tests Source: https://github.com/domdfcoding/whiptail/blob/master/CONTRIBUTING.rst Run automated tests for all configured Python versions using tox. This provides a comprehensive check of the project's compatibility. ```bash $ tox ``` -------------------------------- ### Run tests for all Python versions Source: https://github.com/domdfcoding/whiptail/blob/master/doc-source/contributing.rst Run automated tests across all configured Python versions using tox. ```bash tox ``` -------------------------------- ### Run Mypy Type Checker with Tox Source: https://github.com/domdfcoding/whiptail/blob/master/CONTRIBUTING.rst Check type annotations in the codebase using mypy. This is executed via tox with the 'mypy' environment. ```bash $ tox -e mypy ``` -------------------------------- ### Run mypy type checking Source: https://github.com/domdfcoding/whiptail/blob/master/doc-source/contributing.rst Check type annotations in the codebase using mypy, executed via tox. ```bash tox -e mypy ``` -------------------------------- ### Run tests for a specific Python version Source: https://github.com/domdfcoding/whiptail/blob/master/doc-source/contributing.rst Execute automated tests for a specific Python version, such as Python 3.10, using tox. ```bash tox -e py310 ``` -------------------------------- ### Run Tox Tests for Python 3.10 Source: https://github.com/domdfcoding/whiptail/blob/master/CONTRIBUTING.rst Execute automated tests for a specific Python version, such as Python 3.10, using tox. This helps ensure compatibility with different Python environments. ```bash $ tox -e py310 ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.