How to set windows title in python qt?

14,100

Solution 1

I found answer. Simply you can enter name of application in constructor of QApplication object. Like this. app = QtGui.QApplication(['Here application name']) This name shows in gnome shell.

Solution 2

Gnome required .desktop file located in /usr/share/applications or ~/.local/share/applications.

Example of myapp.desktop file:

[Desktop Entry]
Name=Application Name
Comment= My application description
Terminal=false
Type=Application
Categories=Development;Education
Exec=path/to/main-script
Icon=path/to/icon

Name from example will be displayed in Gnome top bar. Exec is path to your main script (in your case s_main.pyw).
Also you should restart Gnome to show changes (Alt + F2, type r and Enter).

Share:
14,100
user2649114
Author by

user2649114

Updated on June 04, 2022

Comments

  • user2649114
    user2649114 about 2 years

    I develop in pyqt and i made deb package on Ubuntu. It contain .desktop file, so it automatically add icon to main menu. When I start application windows title is correct but in gnome bar shows s_main.pyw which is name of main script in application. It is possible to set correct name in that bar?

    Here's a link to image!