May-02-2017, 08:09 PM
An update:
I don't appear to have the same problem if I call the message box from a button or from a menu. I put the message box code inside a def named doNothing in this code. Either the "Insert Image" button or any of the menus can call it. It runs fine. The message boxes pop up in the foreground.
I don't appear to have the same problem if I call the message box from a button or from a menu. I put the message box code inside a def named doNothing in this code. Either the "Insert Image" button or any of the menus can call it. It runs fine. The message boxes pop up in the foreground.
### https://www.youtube.com/watch?v=PSm-tq5M-Dc <== menus ### https://www.youtube.com/watch?v=D24Vx3_IM8U&t=23s <=== Toolbar from tkinter import * import tkinter.messagebox ### Pull in ability to make message boxes def doNothing(): # print("Okay, okay, I won't") answer = tkinter.messagebox.askquestion('Question 1', 'Do you like silly faces?') if answer == 'yes': tkinter.messagebox.showinfo('Really', 'Here ya go 8===D~ ') # print(' 8===D~ ') elif answer == 'no': tkinter.messagebox.showinfo('Really', 'You sure are boring') def doSomething(): filewin = Toplevel(root) button = Button(filewin, text="Do something button") button.pack() root = Tk() ### ************* Main Menu *********************************** menu = Menu(root) root.config(menu=menu) subMenu = Menu(menu) menu.add_cascade(label="File", menu=subMenu) subMenu.add_command(label="New Project ...", command=doNothing) subMenu.add_command(label="New", command=doNothing) subMenu.add_separator() subMenu.add_command(label="Exit", command=doNothing) editMenu = Menu(menu) menu.add_cascade(label="Edit", menu=editMenu) editMenu.add_command(label="Redo", command=doNothing) ### ************ The Toolbar *********************************** toolbar = Frame(root, bg="blue") insertButt = Button(toolbar, text="Insert Image", command=doNothing) insertButt.pack(side=LEFT, padx=2, pady=2) printButt = Button(toolbar, text="Print", command=doSomething) printButt.pack(side=LEFT, padx=10, pady=10) toolbar.pack(side=TOP, fill=X) ### fill=X makes it fill up all space in the X direction (horizontally) ### ************ The Statusbar *********************************** status = Label(root, text="Preparing to do nothing...", bd=1, relief=SUNKEN, anchor=W) status.pack(side=BOTTOM, fill=X) ### fill = X makes sure that it spans the entire bottom root.mainloop()So I think I'm good. My worries were that I would create some real application and the user would choose something and the message box would be in the background unbeknownst to him, but that doesn't appear to be the case.