Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make PyQt window state to maximised in pyqt

I am using PyQt4 for GUI in my application.

I want to know how can make my window maximized by default.

I goggled but did not found an alternate.

I tried using below code, but its not for maximized instead it resizes the window to desktop screen size.

But i need the effect which we will see when we press the maximize button wt right side of the window title bar.

screen = QtGui.QDesktopWidget().screenGeometry() self.setGeometry(0, 0, screen.width(), screen.height())   
like image 444
Rao Avatar asked Feb 06 '13 10:02

Rao


People also ask

Why use PySide instead of PyQt?

Advantages of PySide PySide represents the official set of Python bindings backed up by the Qt Company. PySide comes with a license under the LGPL, meaning it is simpler to incorporate into commercial projects when compared with PyQt. It allows the programmer to use QtQuick or QML to establish the user interface.

Is PyQt better than PySide?

PyQt is significantly older than PySide and, partially due to that, has a larger community and is usually ahead when it comes to adopting new developments. It is mainly developed by Riverbank Computing Limited and distributed under GPL v3 and a commercial license.

How do I create a window in PyQt5?

We set the window size using the setGeometry(left,top,width,height) method. The window title is set using setWindowTitle(title). Finally show() is called to display the window.


1 Answers

From the docs:

self.showMaximized() 
like image 177
Blender Avatar answered Oct 08 '22 10:10

Blender