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

Uploaded Python 3

File details

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

File metadata

  • Download URL: dynamicinputbox-1.3.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.tar.gz
Algorithm Hash digest
SHA256 69cce4d953b3a819b654c46a50bf9c078ad4ca10835c94253da25dba8dee58a9
MD5 b70ee42b10e1d5c50b2d4aa207d19735
BLAKE2b-256 a9ef78a38a901e38561d1253b81e5738da16c1e391e63682ae8b1869d19f043e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dynamicinputbox-1.3-py3-none-any.whl
  • Upload date:
  • Size: 7.1 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 739c59f873ec01efca446ee387081b2ed409ceb56f264f05dd13e80ff5747b70
MD5 5425359e2e8e8244c0a2bb0cb213750e
BLAKE2b-256 9112d28f1cb2195c63f48f92de9c372f15db26fd48baf72ca5d529a723edb376

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