Python Library: PyMsgBox

A simple, cross-platform, pure Python module for JavaScript-like message boxes.

Table of Contents
Library resources
PyPI https://pypi.org/project/PyMsgBox/
Github https://github.com/asweigart/PyMsgBox
Documentation https://pymsgbox.readthedocs.io/en/latest/

28 Sep 2022

Derived from Stephen Raymond Ferg's EasyGui http://easygui.sourceforge.net

Built by Al Sweigart!! Automate the Boring Stuff with Python, by Al Sweigart

Getting Started

pip3 install PyMsgBox

To use native operating system message boxes, run the following:

import pymsgbox.native as pymsgbox
# import pymsgbox
import pymsgbox.native as pymsgbox
pymsgbox.alert('This is an alert.')
pymsgbox.confirm('Click OK to continue, click Cancel to cancel.')
pymsgbox.prompt('Enter your name.')
pymsgbox.password('Enter your password. (It will appear hidden in this text field.)')
  • All of the arguments to PyMsgBox functions are optional.
pymsgbox.alert(text='', title='', button='OK')
pymsgbox.confirm(text='', title='', buttons=['OK', 'Cancel'])
pymsgbox.prompt(text='', title='' , defaultValue='')
pymsgbox.password(text='', title='', defaultValue='', mask='*')

Snippets

Timeout

add timeout parameter to action, eg:

pymsgbox.alert(timeout=2000)

links

social