0

Python 3.8 tkinter 8.6 Following code creates a child window, but the child is covered by the root window. Why isn't the Toplevel on top ? Tried all 3 geometry managers with no success. Even takefocus doesn't help. The child appears first and is covered by root. ''' from tkinter import *

root = Tk()
root.geometry("900x600")
root.title(" Root window with Toplevel as child") 

achild = Toplevel(root, takefocus = True )  
achild.geometry("300x200+300+200")  
achild.title("This is window named achild")

def main() :    
    mainloop()

if __name__ == '__main__' :
    main()
dlemper
  • 219
  • 3
  • 6
  • Does this answer your question? [How to make a Tkinter window jump to the front?](https://stackoverflow.com/questions/1892339/how-to-make-a-tkinter-window-jump-to-the-front) – Nathan Mills Nov 07 '21 at 04:11

1 Answers1

1

Use the lift method to keep achild above root window:

achild.lift()

The following will keep achild window above other windows (including non-Tk windows):

achild.attributes("-topmost", True)
Nathan Mills
  • 2,243
  • 2
  • 9
  • 15