0

I'm not able to display title on system top bar with code:

import tkinter as tk

root = tk.Tk()
root.title('How to display it on Fedora top bar?')
root.mainloop()

Instead of set title "Tk" is displayed. I'm working on Fedora. Is there another way of setting it? Bellow I am placing a screenshot which illustrates my problem: screen Side note: I have also added desktop entry which doesn't help.

[Desktop Entry]
Type=Application
Terminal=false
Icon=/home/name/icon.gif
Name=MyApp
Exec=/usr/local/bin/app
Categories=Utility;
Ethr
  • 431
  • 1
  • 3
  • 17
  • You understand that the toolbar is not part of your program, it is the window manager. – stark Mar 27 '20 at 13:36
  • How do you expect the Window Manager to look inside your program and guess that the text in one of your root windows should be shown on the toolbar? – stark Mar 27 '20 at 13:37
  • @stark How I expect my window manager to look inside my program? The same way it modified icon before - `root.iconphoto(False, tk.PhotoImage(data=get_icon()))` worked perfectly fine. Why `root.title` not? I don't know. What is way to modify it then? Should I replace some Fedora files? Use `setuptools` somehow? – Ethr Mar 27 '20 at 13:39
  • Hmm. In KDE it shows the 'Name=' line. This is likely a gnome issue. – stark Mar 27 '20 at 13:45
  • The name is set when you run your program. What your program does has no effect unless it makes a call specifically to the WM. Regular Tk calls only affect your program windows. – stark Mar 27 '20 at 13:47
  • 2
    @Ethr Does this answer your question? [rhel-w-tkinter-python3-changing-the-activity-name-from-tk](https://stackoverflow.com/questions/59144939) – stovfl Mar 27 '20 at 14:59
  • @stovfl Thank you so much that was it! I spent a lot of time on searching, but could't find that solution. Linked question has no accepted answer. If you would like to post it here (for better visibility) I will mark it as solution for my problem. – Ethr Mar 27 '20 at 17:02
  • @Ethr ***"Linked question has no accepted answer."***: It has a ccepted answer at **ask ubuntu**. It depend on the used Window Manager, please edit your question and tell which Window Manager you are using. – stovfl Mar 27 '20 at 18:49

1 Answers1

0

Solution found thanks to @stovfl explanation in comments:

import tkinter as tk

root = tk.Tk(className='Thats how!')
root.title('How to display it on Fedora top bar?')
root.mainloop()
Ethr
  • 431
  • 1
  • 3
  • 17