Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set windows title in python qt?

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!

like image 971
user2649114 Avatar asked Aug 08 '13 18:08

user2649114


People also ask

How do I change the title of a window in Qt?

EDIT: If you are using QtDesigner, on the property tab, there is an editable property called windowTitle which can be found under the QWidget section. The property tab can usually be found on the lower right part of the designer window.

What is qt5 in Python?

PyQt5 is cross-platform GUI toolkit, a set of python bindings for Qt v5. One can develop an interactive desktop application with so much ease because of the tools and simplicity provided by this library. A GUI application consists of Front-end and Back-end.

How do I create a drop down menu in PyQt?

First, we define the comboBox, then we add a bunch of options, then we move the comboBox (a drop down button). When the combo box has a choice, it will take the string version of the choice, and run self.

Can you use Qt Creator with Python?

To create a GUI for your windows and dialogs in PyQt, you can take two main paths: you can use Qt Designer, or you can hand code the GUI in plain Python code.


2 Answers

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.

like image 143
user2649114 Avatar answered Oct 17 '22 06:10

user2649114


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).

like image 36
user3752871 Avatar answered Oct 17 '22 06:10

user3752871