Entry
How can I create a Tkinter MessageBox with the MessageBox - option "YESNOCANCEL"?
Dec 18th, 2009 17:20
new acct, Scott Mandarich, unknown unknown, Robert Roy
Problem:
When I use -
import tkMessageBox
tkMessageBox.askquestion("equal","even better", icon=QESTION,
type=YESNOCANCEL)
The error message here is: NameError: QUESTION
Solution:
QUESTION is not in your namespace
try
tkMessageBox.askquestion("equal",
"even better",
icon=tkmessageBox.QUESTION,
type=tkMessageBox.YESNOCANCEL)
however this will bring up another a type error:
keyword parameter redefined.
so then instead of using askquestion use _show
tkMessageBox._show("equal",
"even better",
icon=tkmessageBox.QUESTION,
type=tkMessageBox.YESNOCANCEL)
If you look at the sources you will see that askquestion is just a
shortcut for
_show(title, message, icon, type) where icon=QUESTION and type=YESNO
ref:
def askquestion(title=None, message=None, **options):
"Ask a question"
return _show(title, message, QUESTION, YESNO, **options)