How can I get rid of the Python (or matplotlib
) icon when running this code? Even when I add icon='info'
, I still get the rocket with the python logo. Please check the photo in reference.
from tkinter import * import tkinter as tk from tkinter import messagebox as tm
root=Tk() root.geometry("1200x1200") canvas1 = tk.Canvas(root, width = 300, height = 300) canvas1.pack() def ExitApplication():
text=text= ' Our team thank you for your visit ! '
MsgBox=tk.messagebox.askquestion('Exit the platform' , text, icon='info')
if MsgBox=='yes':
root.destroy()
else:
tk.messagebox.showinfo('Return', 'You will now return to the application screen ', icon='info')
exit_button = Button(root, text="Exit ", command=ExitApplication) canvas1.create_window(200, 200, window=exit_button)
root.mainloop()
icon=info
is used for changing the icon inside message box. Answered here nicely.Referring to this question and its comments, one solution could be to create your own custom messagebox using
tk.Toplevel()
:Here is an example of how you would be coding it. (You can further make it more efficient for multiple messageboxes):
But if you are looking for a solution to change the default icon with an .ico icon file, for entire Tkinter windows including MessageBox refer here, just use
iconbitmap
: