Centering the window on the screen
The windowed applications based on type and functionality get displayed in the center for main applications, top right for notifications, and as an icon in the status bar of the screen. It is best practice for any main GUI application to display the window centered on the screen. There are two advantages of doing this. The first is to get the attention of the user, and the other is to adjust to different display formats of the 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 central to any screen. This method takes the object that it is calling and centers it with respect to the screen that it is displayed on:
def center(self): """ Function to center the application """ qRect = self.frameGeometry() centerPoint = QDesktopWidget().availableGeometry...