如何在pyqt中使PyQt窗口状态最大化 [英] How to make PyQt window state to maximised in pyqt

查看:93
本文介绍了如何在pyqt中使PyQt窗口状态最大化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中使用 PyQt4 作为 GUI.

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

推荐答案

来自 文档:

self.showMaximized()

这篇关于如何在pyqt中使PyQt窗口状态最大化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆