Reputation: 41
I've create a GUI in "Qt Designer". Now I'd like to open a simple window with a minimize/maximize buttons in the top right corner.
from PyQt5 import uic
window = uic.loadUi("Video_Player.ui") # Video_Player.ui is the name of my GUI main file.
window.show()
should be something like this:
window.setWindowFlag(Qt.WindowMinimizeButtonHint , True)
But I don't know how to set/define my Qt to make it work...?
Upvotes: 0
Views: 2137
Reputation: 26
I think you should firstly hide the Windows bar in this way:
self.setWindowFlag(Qt.FramelessWindowHint)
And then add your own Minimize, Maximize and Close botton on QtDesigner. Finally for example you can make them work as follows in your code:
self.maxBtn = self.findChild(QPushButton,'Maximize_btn')
self.maxBtn.clicked.connect(lambda: self.showMaximized())
self.minBtn = self.findChild(QPushButton,'Minimize_btn')
self.minBtn.clicked.connect(lambda: self.showMinimized())
self.closeBtn = self.findChild(QPushButton,'Close_btn')
self.closeBtn.clicked.connect(lambda: self.close())
Upvotes: 1
Reputation: 443
self.setWindowFlags(_qt.FramelessWindowHint)
This hides standard window's titlebar
Upvotes: 0