0

When I am trying to write a syntax for messagebox in tkinter like this

''' 'root=tkinter.Tk()' 'Messagebox.Showinfo()' '''

It is popping up root window although I have not called root.mainloop() How is this happening?

  • Thanks for responding TheLizzard, Simply running root=tkinter. Tk() is not popping up root window, it is when I am also writing messagebox. Showinfo() syntax along with first one. I am using pycharm IDE. – manish kumar Jun 12 '21 at 13:27
  • If you want to hide the window, just use `root.withdraw()`. – TheLizzard Jun 12 '21 at 13:30
  • That's ok but I want to use the root window to popup at the last line of code so that I could write more codes after the messagebox.otherwise the code is hanging at the messagebox.info() syntax. I want to know why it happens when we call messagebox.showinfo() . – manish kumar Jun 12 '21 at 13:33
  • The `showinfo` function creates a `Toplevel` and calls `.wait_window()` which is something like a `.mainloop()` that runs until that pop up is closed. For more info please read [this](https://stackoverflow.com/q/28388346/11106801). – TheLizzard Jun 12 '21 at 13:37
  • Thanks TheLizzard.. It is convincing to me – manish kumar Jun 12 '21 at 14:10

0 Answers0