hi all

i cant figure out how to put popup window to show in the middle of my text editor?
It is writen with Toplevel in tkinter.


thx

Have you tried the tkMessageBox module? It has modal dialogs like showinfo and askyesno.

Jeff

Hi I have custom dialog that needs to popup in the middle of the screen or in the middle of my gui

Then you can create it and call its lift() or raise() method to make it show up above the parent.

Jeff

Something like this will work fine:

from Tkinter import *
    
root = Tk()
root.title('root win')
root.geometry("400x300+30+30")
# create child window
top = Toplevel()
top.title('top win')
top.geometry("200x100+100+130")
top.lift(aboveThis=root)
 
root.mainloop()
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.