Dialoger
Dialoger is a Python package that provides a set of functions to create interactive dialog windows for your applications.
Installation
You can install Dialoger using pip:
pip install dialoger
Usage
Dialoger provides a set of functions to create interactive dialog windows with ease. The functions are: ask, askwithanswers, confirm, alert, info, error and success.
ask
The ask function creates a dialog window with a question and a text input. It returns the text inputted by the user.
Parameters
title: The title of the dialog window.question: The question to be asked to the user.answer_type: The type of the answer. Can bestr,int,float,alphanumericorpassword.answer_default(optional): The default answer. IfNone, the text input will be empty.pattern(optional): A pattern to validate the answer. # will be replaced by the number. For example,##/##/####can be used to ask for a date or###.###.###-##to ask for a CPF. IfNone, no pattern will be used.allow_empty(optional): IfTrue, the user can leave the text input empty. IfFalse, the user must input something.allow_cancel(optional): IfTrue, the user can cancel the dialog window. IfFalse, the user must answer the question.entrance_width(optional): The width of the text input. If omitted, the width will be 35.
import dialoger
date = dialoger.ask('Birth date''', 'What is your birth date?', 'str', pattern='##/##/####', allow_empty=False, allow_cancel=False)
print(f"You were born in {date}")
askwithanswers
The askwithanswers function creates a dialog window with a question and a list of choices. It returns the choice selected by the user.
Parameters
title: The title of the dialog window.question: The question to be asked to the user.choices: A list of choices.
import dialoger
answer = dialoger.askwithanswers('Favorite color', 'What is your favorite color?', ['Red', 'Green', 'Blue'])
print(f"Your favorite color is {answer}")
confirm
The confirm function creates a dialog window with a message and two buttons. It returns True if the user clicks the first button, or False if the user clicks the second button. The default buttons are "Yes" and "No", but you can change them by passing a list of strings as the choices parameter.
Parameters
title: The title of the dialog window.message: The message to be displayed to the user.choices(optional): A list of strings to be used as the buttons. The first string will be used as the first button, and the second string will be used as the second button. IfNone, the default buttons will be used.
import dialoger
answer = dialoger.confirm('Confirm', 'Are you sure you want to delete this file?')
if answer:
print('File deleted')
else:
print('File not deleted')
alert, info, error and success
The alert, info, error and success functions create a dialog window with a message and a button. They don't return anything.
Parameters
title: The title of the dialog window.message: The message to be displayed to the user.
import dialoger
dialoger.alert('Alert', 'This is an alert')
dialoger.info('Info', 'This is an info')
dialoger.error('Error', 'This is an error')
dialoger.success('Success', 'This is a success')
Minimum dependencies
Dialoger has no dependencies. It uses only the standard Python Tkinter library.
Appropriate icons
For each interaction, an icon corresponding to the type of interaction is displayed in the window. The icons are:
License
Dialoger is licensed under the MIT License. See LICENSE for more information.
Contributing
Contributions are welcome! You can contribute by opening an issue or submitting a pull request.
Credits
Dialoger was created by Guilherme Saldanha.
Metadata
Release files for dialoger 1.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dialoger-1.3.0.tar.gz | 21.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dialoger-1.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 45.2 kB
Release files / dialoger-1.3.0.tar.gz
| Download URL | dialoger-1.3.0.tar.gz |
|---|---|
| Size | 21.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a121a7c47df76554fd4286f38ce6d695b8c758dd494818c39b3fd9b0866a2e22
|
|
BLAKE2b-256 checksum How to use checksums |
f62ddf546ef8e4459d6039381e831923d451667fa9fb241065d1c3afd8315285
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|
Release files / dialoger-1.3.0-py3-none-any.whl
| Download URL | dialoger-1.3.0-py3-none-any.whl |
|---|---|
| Size | 23.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8f28e95eb42d03a91a092c86e40755ee56dbfdf9955664917f1530f7f51f529c
|
|
BLAKE2b-256 checksum How to use checksums |
d5e7423a0e568a4ed71ca8f17ffd54bbb7144df76b2a27f26c2465dd17b7d8d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.11
|