O'Reilly logo

PySide GUI Application Development by Venkateshwaran Loganathan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Centering the Window on the screen

Many windowed applications will get their importance by the way they are displayed on the screen. It is better practice for any GUI application to display the window centered on the screen. There are two advantages of doing this. One is to get the attention of the user and the other is to adjust with different display formats of various monitor screens.

There is no straightforward method to center the window by calling a predefined function of some class. Therefore, we write our own method called center to position the window center to any screen. The method takes the object it is calling and centers it with respect to the screen it is displayed:

 def center(self): """ Function to center the application """ qRect ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required