0

I have a script where I want to use a message box for the occasional interactive question

# python 3.1
from tkinter import *
from tkinter import ttk
from tkinter import messagebox
answer = messagebox.askyesno(message="Are you thinking of the " + "data " + "?"
                             ,icon='question' ,title="My guess"

when I run this, I get the message box. I also get a blank tk window, which does not disappear when the message box is dismissed. Is there any way to avoid this?

3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by vegaseat
1

Use root.withdraw

from tkinter import *
##from tkinter import ttk
from tkinter import messagebox

root = Tk()
root.withdraw()
answer = messagebox.askyesno(message="Are you thinking of the " + "data " + "?"
                             ,icon='question' ,title="My guess")
print(answer)
0

Python31 includes the Tkinter Tile extension module ttk.

Ttk comes with 17 widgets, 11 of which already exist in Tkinter:
Button, Checkbutton, Entry, Frame, Label, LabelFrame, Menubutton,
PanedWindow, Radiobutton, Scale and Scrollbar

The 6 new widget classes are:
Combobox, Notebook, Progressbar, Separator, Sizegrip and Treeview

You have to do some detective work on file
C:/Python31/Lib/tkinter/test/test_ttk/test_widgets.py
to figure out how these widgets work

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.