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?

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)

Thanks, that's great! How do you learn ttk properly?

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.