Psidialogs
Python Simple Dialogs
Install / Use
/learn @ponty/PsidialogsREADME
psidialogs (Python Simple Dialogs) is a wrapper for different standard dialogs: message, warning, error, ask_ok_cancel, ask_yes_no, ask_string, ask_file, ask_folder, choice.
Links:
- home: https://github.com/ponty/psidialogs
- PYPI: https://pypi.python.org/pypi/psidialogs
back-ends:
Installation
$ python3 -m pip install psidialogs
Install all back-ends on Ubuntu 22.04:
$ sudo apt-get install python3-tk
$ sudo apt-get install python3-pyqt5
$ sudo apt-get install python3-pyside2.qtwidgets
$ sudo apt-get install python3-dialog
$ sudo apt-get install python3-easygui
$ sudo apt-get install python3-wxgtk4.0
$ sudo apt-get install zenity
$ sudo apt-get install gxmessage
Usage
# psidialogs/examples/message.py
import psidialogs
psidialogs.message("Hello!")

# psidialogs/examples/warning.py
import psidialogs
psidialogs.warning("Warning text.")

# psidialogs/examples/error.py
import psidialogs
psidialogs.error("Error text.")

# psidialogs/examples/ask_ok_cancel.py
import psidialogs
ok = psidialogs.ask_ok_cancel("Do you want to continue?")
if ok:
print("continue")

# psidialogs/examples/ask_yes_no.py
import psidialogs
yes = psidialogs.ask_yes_no("Yes or no?")
if yes:
print("yes!")

# psidialogs/examples/ask_string.py
import psidialogs
name = psidialogs.ask_string("What is your name?")
if name is not None:
print(name)

# psidialogs/examples/ask_file.py
import psidialogs
f = psidialogs.ask_file("Select a file!")
if f is not None:
print(f)

# psidialogs/examples/ask_folder.py
import psidialogs
f = psidialogs.ask_folder("Select a folder!")
if f is not None:
print(f)

# psidialogs/examples/choice.py
import psidialogs
s = psidialogs.choice(["1", "2", "3"], "Choose a number!")
if s is not None:
print(s)

The implemented backends can be listed, the order is the preference, which can be changed:
# psidialogs/examples/backends.py
import psidialogs
print(psidialogs.backends())
psidialogs.set_backend_preference(["tkinter", "zenity"])
print(psidialogs.backends())
<!-- embedme doc/gen/python3_-m_psidialogs.examples.backends.txt -->
$ python3 -m psidialogs.examples.backends
['pyside2', 'tkinter', 'zenity']
['tkinter', 'zenity', 'pyside2']
Changing the backend preference:
# psidialogs/examples/set_backend_preference.py
import psidialogs
psidialogs.set_backend_preference(["tkinter", "zenity"])
psidialogs.message("Hello!")

Demo
<!-- embedme doc/gen/python3_-m_psidialogs.examples.demo.txt -->All backends and all dialog types can be tested with the demo:
$ python3 -m psidialogs.examples.demo

The demo can be started with one backend:
$ python3 -m psidialogs.examples.demo --backend zenity

The demo can be started with one backend and one dialog type:
$ python3 -m psidialogs.examples.demo --backend zenity --dialogtype message

Demo full help:
$ python3 -m psidialogs.examples.demo --help
usage: demo.py [-h] [-b BACKEND] [-d DIALOGTYPE] [-t TITLE] [--debug]
optional arguments:
-h, --help show this help message and exit
-b BACKEND, --backend BACKEND
-d DIALOGTYPE, --dialogtype DIALOGTYPE
-t TITLE, --title TITLE
--debug set logging level to DEBUG
Screenshots
Screenshots are created on Ubuntu 22.04 server with Xvfb.
Versions:
<!-- embedme doc/gen/python3_-m_psidialogs.check.versions.txt -->$ python3 -m psidialogs.check.versions
python 3.8.10
psidialogs 0.2.0
pyside2 5.14.0
tkinter 8.6
zenity 3.32.0
message(), warning(), error()
| backend | message | warning | error |
| -----------: | ------------------------------------- | ------------------------------------- | ----------------------------------- |
| zenity |
|
|
|
| gmessage |
|
|
|
| wxpython |
|
|
|
| tkinter |
|
|
|
| easygui |
|
|
|
| pyqt5 |
|
|
|
| pyside2 |
|
|
|
| pythondialog |
|
|
|
| console |
|
|
|
ask_ok_cancel(), ask_yes_no(), ask_string()
| backend | ask_ok_cancel | ask_yes_no | ask_string |
| -----------: | ------------------------------------------- | ---------------------------------------- | ---------------------------------------- |
| zenity |
|
|
|
| gmessage |
|
|
|
| wxpython |
|
|
|
| tkinter |
|
|
|
| easygui |
|
|
|
| pyqt5 |
|
|
|
| pyside2 |
|
|
|
| pythondialog |
|
|
|
| console |
|
|
|
ask_file(), ask_folder()
| backend | ask_file | ask_folder |
| -----------: | -------------------------------------- | ---------------------------------------- |
| zenity |
|
|
| gmessage |
|
|
| wxpython |
|
|
| tkinter |
|
|
| easygui |
|
|
| pyqt5 |
|
|
| pyside2 |
|
|
| pythondialog |
|
|
| console |
|
|
choice()
| backend | choice |
| -----------: | ------------------------------------ |
| zenity |
|
| gmessage |
|
| wxpython |
|
| tkinter |
|
| easyg
Related Skills
node-connect
347.9kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
108.7kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.9kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.9kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
