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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dynamicinputbox-1.2.tar.gz.
File metadata
- Download URL: dynamicinputbox-1.2.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a12fcd4e8a938a206593ae243f398c4d9c9053d15b01cddc00edcf2a12da84c2
|
|
| MD5 |
418f0b473c8e80e14f940e3758704bf3
|
|
| BLAKE2b-256 |
e374524bba75e124416b6f2e4ffa7c53a812274cf8139980025615f1c86b8fa1
|
File details
Details for the file dynamicinputbox-1.2-py3-none-any.whl.
File metadata
- Download URL: dynamicinputbox-1.2-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aaace4756faea023e452624be0f794001a688acb8a1dc253b872a951f764a412
|
|
| MD5 |
f4a1d921bb31a3b229c061ea24288513
|
|
| BLAKE2b-256 |
383a9b83423baa364b591f9a6925cadadd73df9511ca11f27c6c60915ac0a97c
|