Skip to main content

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

Project description

PePy statistics PyPI Downloads

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.

For input entered where show has been defined, the value will be returned as clear text, but in a bytearray to keep it better secured.

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.3.1.tar.gz (6.4 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.3.1-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for dynamicinputbox-1.3.1.tar.gz
Algorithm Hash digest
SHA256 32c2f1cfa08c263c3f07605afcf3bdbba82bd60c0533ff6487d22c1a29a13378
MD5 86b15724ad7b079992aedf8820418cdb
BLAKE2b-256 ac4c3bf4ef60c3be06030ea0f9fddb8b06698bf506c9e03634fc02092dfaf9d8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dynamicinputbox-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a15c393393b0ac664f092336834a21f615d1c1f5d2c65d5cc0e830d168789164
MD5 6be8c0a7e229c32026c38a018efb5cf5
BLAKE2b-256 83334bc3b69a8b2320a8ef4d2c375995868d49ab6b06e7b957588bd2aeb8af16

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