Skip to main content

Creates a dynamic inputbox with the possisiblity to add inputboxes and/or alternatives

Project description

About

A dynamic and customizable input dialog box using Tkinter.

Creates a dialog window that can display a message, accept one or more text inputs (with optional presets, default values, and masked input), offer grouped radio button alternatives, and allow the user to respond via custom buttons.

Parameters

  • title (str): The window title. Default is an empty string.
  • message (str): An optional message to be displayed above inputs.
  • input (bool): [Deprecated]
    • If True, a single text input field is displayed using input_default, input_show, and preset_text.
    • If False, 'inputs' must be used to specify fields. Default is False.
  • input_default (str): [Deprecated] Default value for the single input field (used only if 'input' is True).
  • input_show (Optional[str]): [Deprecated] Character used to mask input (e.g., '*') for the single input field.
  • preset_text (Optional[str]): [Deprecated] Greyed-out preset text for the single input field, replaced on key press.
  • inputs (Optional[List[Dict[str, Union[str, None]]]]): A list of input definitions. Each input is a dict with optional keys:
    • 'label': Display label for the input field (required).
    • 'default': Pre-filled value.
    • 'show': Character to display instead of actual input (e.g., '*').
    • 'preset': Greyed-out prompt text, removed on typing.
  • alternatives (Optional[List[Dict[str, Union[str, List[str]]]]]): A list of grouped radio button sets. Each group is a dict with:
    • 'label': Group name (required).
    • 'options': List of option strings (required).
    • 'default': Pre-selected option (defaults to the first in 'options').
  • buttons (Optional[List[str]]): A list of button labels to display. The clicked button is returned. Default is ['OK'].
  • default_button (Optional[str]): Which button should be pre-focused. If not set, the first button is focused (unless inputs exist).
  • separator (Optional[bool]): Is a separator to be placed between each widget group

Returns

The class itself does not return a value upon instantiation.

To access the user's input after the dialog closes, use the get() method.

get( dictionary = False ) returns a tuple:

( inputs_dict, alternatives_dict, clicked_button )

  • inputs_dict: a dictionary mapping each input's label to the entered value.
  • alternatives_dict: a dictionary mapping each alternative group to the selected option.
  • clicked_button: the label of the button clicked by the user.

get( dictionary = True ) returns a dictionary:

{ 'button': 'Clicked button' , 'inputs': {} , 'alternatives: {} }

  • 'button': '...': text of the button that was clicked
  • 'inputs': {...}: a dictionary mapping each input's label to the entered value.
  • 'alternatives': {...}: a dictionary mapping each alternative group to the selected option.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dynamicinputbox-1.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dynamicinputbox-1.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file dynamicinputbox-1.0.tar.gz.

File metadata

  • Download URL: dynamicinputbox-1.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for dynamicinputbox-1.0.tar.gz
Algorithm Hash digest
SHA256 d4addd485e9ad7c1df34c37eb60bb5c2a64d12d5a35f606b2601a16126060b5e
MD5 79094987754f636cf26b9ed594247a1c
BLAKE2b-256 6f61630edd6e7d05e268bba0b3bf2ea9fdc5dc14bd570c43bf91f912be929d07

See more details on using hashes here.

File details

Details for the file dynamicinputbox-1.0-py3-none-any.whl.

File metadata

  • Download URL: dynamicinputbox-1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for dynamicinputbox-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6dfd6d4f4f5470dcf18c24fdd7d39fc3e6d5e22681982a8d69e2add1f475d6db
MD5 41cc0f8aaf8960c61e4e959afc9e11ce
BLAKE2b-256 a5f1a95fada567f6463ff3b8a2d6732acb330749bc3f1d7471dadf0c8e690c75

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page