Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tkinter: messagebox doesn`t work right. (get two windows)

I am using python 3. If I opan an error messagebox, i get two frames, one is emty and one is the error-window. That is my code:

from tkinter import messagebox

messagebox.showwarning('warning', 'warning')
like image 327
user8400839 Avatar asked Oct 26 '25 10:10

user8400839


2 Answers

Everything works correctly in your example. The empty window is the main window of Tk. It is always open when you start any Tk program. You can minimize it if you want, but closing it terminates the main loop.

like image 150
DYZ Avatar answered Oct 29 '25 00:10

DYZ


Try this:

  root = tkinter.Tk()
  root.withdraw()
  messagebox.showwarning('warning', 'warning')
like image 29
Ameneh Sh Avatar answered Oct 29 '25 00:10

Ameneh Sh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!