<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p><i><font size="+1">Greetings all, I am trying to implement maximize and minimize with a single button (my window has no title bar) but ovbiamente not know how to do this is what led until now. Please help</font></i></p>
<p><i><font size="+1"><br>
</font></i></p>
<p><i><font size="+1"></font></i># -*- coding: utf-8 -*-<br>
#############################<br>
import sys<br>
#############################<br>
from PyQt5.QtCore import *<br>
from PyQt5.QtGui import *<br>
from PyQt5.QtWidgets import *<br>
from PyQt5.uic import *<br>
from sinergia import *<br>
<br>
class Mast(QMainWindow):<br>
"""docstring for Raiz"""<br>
def __init__(self):<br>
super(Mast, self).__init__()<br>
QMainWindow.__init__(self)<br>
<br>
loadUi('ui/principal.ui', self)<br>
self.setWindowFlags(Qt.SplashScreen)<br>
<br>
self.minx.setCursor(Qt.PointingHandCursor)<br>
self.minx.setScaledContents(True)<br>
self.minx.setPixmap(QPixmap("img/min.ico"))<br>
<br>
self.maxb.setCursor(Qt.PointingHandCursor)<br>
self.maxb.setScaledContents(True)<br>
self.maxb.setPixmap(QPixmap("img/maxx.ico"))<br>
<br>
self.clos.setCursor(Qt.PointingHandCursor)<br>
self.clos.setScaledContents(True)<br>
self.clos.setPixmap(QPixmap("img/cierre.ico"))<br>
<br>
<br>
self.minx.mouseReleaseEvent = self.mini<br>
self.maxb.mouseReleaseEvent = self.maxx<br>
self.clos.mouseReleaseEvent = self.salir<br>
#.........................................................................................<br>
def salir(self, event):<br>
sys.exit()<br>
<br>
def mini(self, event):<br>
self.setWindowState(Qt.WindowMinimized)<br>
<br>
def maxx(self, event):<br>
band = False<br>
if band:<br>
self.setWindowState(Qt.WindowMaximized)<br>
band = True<br>
else:<br>
self.setMinimumSize(900, 569)<br>
<br>
band = False<br>
<br>
<br>
<br>
if __name__ == '__main__':<br>
app = QApplication(sys.argv)<br>
ap = Mast()<br>
ap.show()<br>
sys.exit(app.exec_())<br>
</p>
</body>
</html>