Reputation: 1129
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??
Upvotes: 0
Views: 309
Reputation: 48479
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.
Upvotes: 1
Reputation: 1129
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()
Upvotes: 0