EasyGUI
EasyGUI is a module for very simple, very easy GUI programming in Python. It differentiates from other GUI libraries by not being event-driven; instead, all GUI interactions are invoked by simple blocking function calls. The current version is 0.98.3, released on April 1, 2022, with an infrequent release cadence.
Warnings
- gotcha EasyGUI programs often conflict with the IDLE IDE (Python's default editor) because both EasyGUI (via Tkinter) and IDLE use their own event loops, leading to unpredictable behavior or freezing.
- breaking EasyGUI 0.98.0 introduced a syntax error (`except Exception, e:`) that was incompatible with Python 3.5+ due to changes in exception handling syntax.
- gotcha EasyGUI is NOT event-driven. Its functions are blocking calls; the program execution pauses until the user interacts with and closes the displayed dialog box. This is fundamentally different from traditional GUI frameworks.
- gotcha The `multenterbox()` function (and similar input boxes) returns user input as a list of strings, even for single fields or intended numeric inputs. Attempting to perform arithmetic directly on these string elements will result in `TypeError`.
- gotcha When displaying images in functions like `buttonbox()`, EasyGUI only natively supports GIF (.gif) file format.
Install
-
pip install easygui
Imports
- easygui
import easygui as eg
- *
Quickstart
import easygui as eg
import sys
# Display a simple message box
eg.msgbox("Hello from EasyGUI!", "Welcome")
# Ask a yes/no question
if eg.ynbox("Shall I continue?", "Question"):
# If user chose Yes, ask for input
name = eg.enterbox("What is your name?", "Name Input")
if name:
eg.msgbox(f"Hello, {name}!", "Greeting")
else:
eg.msgbox("You cancelled the name input.", "Cancelled")
else:
eg.msgbox("You chose to exit.", "Exit")
sys.exit(0)