I already have a custom frameless window application in Pyqt5. I just want the application to be once opened, get to full size depending upon the different resolutions of different PC's.
I want only _ and X buttons and not a [] (maximize) button, because I want it to maximize automatically. Is there any way to do that??
The best approach to achieve that is to use a combination of showMaximized()
and the disabled WindowMaximizeButtonHint
window flag :
class MyWindow(QtWidgets.QMainWindow):
def __init__(self):
super().__init__()
self.setWindowFlags(
self.windowFlags() & ~QtCore.Qt.WindowMaximizeButtonHint)
# ...
myWindow = MyWindow()
myWindow.showMaximized()
The only problem with this is that (at least on Windows) as soon as you disable the maximize button, the window becomes movable.
I just found that solution. We can do that by :
from PySide import QtGui
app = QtGui.QApplication([])
screen_resolution = app.desktop().screenGeometry()
width, height = screen_resolution.width(), screen_resolution.height()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.