Skip to main content

Easily generate GUI prompts without the hassle of making a whole GUI

Project description

simple-gui-prompt

Easily generate GUI prompts without the hassle of making a whole GUI. Handy for scripts when all you really want is a text box or list or something.

Setup

pip install simple-gui-prompts
import prompts

Prompts supported

prompts.dialog(title, text, block=True): A simple popup box with a title and text that only has an OK button and returns None. If block=True (default), execution is blocked until the box is closed. If block=False, it returns immediately after creating the dialog

prompts.confirm(title, text, **kwargs): A popup which offers for the user to either confirm (returning True) or deny (returning False), with a closed window returning False. A yes= kwarg can be used to change the text on the confirm button (which defaults to 'OK'), and the no= kwarg can be used to change the text on the deny button (which defaults to 'Cancel'). Additionally, yesno=True can be used to replace the confirm and deny defaults with 'Yes' and 'No' respectively, in which case yes= and no= will be ignored if present.

prompts.text(title, text, **kwargs): A popup containing a text box, which returns a string representing the text that was put in, or None if the user cancelled. Allowed kwargs are:

canCancel=True: Defines whether the user gets a cancel button. This button causes the function to return None regardless of what was entered.

yes='OK': Text that appears on the OK button

no='Cancel': Text that appears on the cancel button

password=False: If True, hide the characters as they are entered.

validate=None: Can be set to a callable which will be passed the user string as the first parameter, and should return True or Flase depending on whether the input is valid. If it is invalid, another identical prompt will be generated, and only the valid input will be returned. If None, the string will be returned unconditionally

prompts.choice(title, text, choices, **kwargs): A popup which displays multiple choices, permitting the user to choose one of the choices, and returning the string that was chosen. Allowed kwargs are canCancel and no, behaving identically to the equivalent kwargs on prompts.getText.

prompts.choiceMulti(title, text, choices, **kwargs): This is identical to prompts.choice, except the user can choose multiple items, and the return value is a list of objects that were chosen. Therefore, it also permits the yes kwarg

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

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

simple-gui-prompts-1.1.0.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

simple_gui_prompts-1.1.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file simple-gui-prompts-1.1.0.tar.gz.

File metadata

  • Download URL: simple-gui-prompts-1.1.0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.4

File hashes

Hashes for simple-gui-prompts-1.1.0.tar.gz
Algorithm Hash digest
SHA256 93c140b630b4d27258009bd372f660df296b8602159f7250e98522863b6d3304
MD5 9b5379c30fc3def2cf96646194ca2169
BLAKE2b-256 4aebf07348b47e22e3b91381093f5a6b6a1d124e9e3443b8e24b36e5f9568efa

See more details on using hashes here.

File details

Details for the file simple_gui_prompts-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: simple_gui_prompts-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.0.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.4

File hashes

Hashes for simple_gui_prompts-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 82d7bc6b92d4cc80d72e919ecccd6caf722795cc75de911539722a113ad3dc80
MD5 396f1383b30316ac4c24e387a2336328
BLAKE2b-256 cfd9a3f5b4e605b106c7145b8d2e9d1986bc57f708ea790e77f2e71b69fb492b

See more details on using hashes here.

Supported by

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