1

I'm experimenting with python and tkinter. I have a main tk window (tk.Tk) and a splash window (tk.Toplevel)

I added an icon to both windows using the following line

self.iconphoto(False, tk.PhotoImage(file=globali.IMG_PATH + 'virtuve_ico.png'))

It's working fine but if I go with my mouse over the icon on icon tray (taskbar) it shows a text saying 'Tk' or 'Toplevel. I would like to change it to "My App Name".

Toplevel on mouse over Tk on mouse over

Is that possible?

Thanks to everybody

stovfl
  • 14,998
  • 7
  • 24
  • 51
Enrico Galli
  • 21
  • 1
  • 5

2 Answers2

1

The correct solution in my case was to add a className parameter like this

 root = tk.Tk(className="My App")

But because I am using my own class I had also to pass the className to the superclass

root = MyClass(className="My App")
root.mainloop()

class MyClass(tk.Tk):
def __init__(self, className):
    super().__init__(className=className)

Thanks to everyone

Enrico Galli
  • 21
  • 1
  • 5
0

If setting the title doesn't work, try using the wm_iconname() method of the tkinter.Tk object.

In [1]: import tkinter as tk

In [2]: root = tk.Tk()
Out[2]: <tkinter.Tk object .>

In [3]: root.wm_iconname?
Signature: root.wm_iconname(newName=None)
Docstring:
Set the name of the icon for this widget. Return the name if
None is given.
File:      /usr/local/lib/python3.7/tkinter/__init__.py
Type:      method
Roland Smith
  • 42,427
  • 3
  • 64
  • 94