Skip to Content
Python GUI Programming with Tkinter
book

Python GUI Programming with Tkinter

by Alan D. Moore
May 2018
Beginner to intermediate content levelBeginner to intermediate
452 pages
11h 26m
English
Packt Publishing
Content preview from Python GUI Programming with Tkinter

Tkinter messagebox

The best way to display simple dialog boxes in Tkinter is by using the tkinter.messagebox library, which contains several convenient functions that allow you to quickly create common dialog types. Each function displays a preset icon and a selection of buttons with a message and detail text that you specify, and returns a value depending on which button the user clicked.

The following table shows some of the messagebox functions with their icons and return values:

Function Icon Button / return value
askokcancel Question Ok (True), Cancel (False)
askretrycancel Warning Retry (True), Cancel (False)
askyesno Question Yes (True), No (False)
askyesnocancel Question Yes (True), No (False), Cancel (None)
showerror ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python GUI Programming with Tkinter - Second Edition

Python GUI Programming with Tkinter - Second Edition

Alan D. Moore

Publisher Resources

ISBN: 9781788835886Supplemental Content