lift a tkMessageBox lift a tkMessageBox tkinter tkinter

lift a tkMessageBox


I think the message box is only ever guaranteed to be above its parent. If you create a second toplevel and you want a messagebox to be on top of that second window, make that second window the parent of the messagebox.

tl2 = tk.Toplevel(...)...tkMessageBox.showinfo("Say Hello", "Hello World", parent=tl2)


I do not see the issue that you describe. The code I wrote below is just about the minimum needed to create a window which creates a second window. The second window creates an info box using the showinfo method. I wonder whether you have something besides this. (Note that I made the windows somewhat large in order to attempt cover up the info window.)

from Tkinter import Tk, Button, Toplevelimport tkMessageBoxtop = Tk()def make_window():    t = Toplevel(top)    t.title("I'm Window 2. Look at me too!")    B2 = Button(t, text = "Click me", command = hello)    B2.pack()    t.geometry('500x500+50+50')def hello():    tkMessageBox.showinfo("Say Hello", "Hello World")B1 = Button(top, text = "New Window", command = make_window)B1.pack()top.title("I'm Window 1. Look at me!")top.geometry('500x500+100+100')top.mainloop()

This was tested on Windows 7 (64-bit) using Python 2.7 (32-bit). It produces something like this:

enter image description here