[PyQt] Help me pleace

Sabroso Rico charolastra at outlook.com
Wed Sep 14 16:59:46 BST 2016


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


# -*- coding: utf-8 -*-
#############################
import sys
#############################
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.uic import *
from sinergia import *

class Mast(QMainWindow):
    """docstring for Raiz"""
    def __init__(self):
        super(Mast, self).__init__()
        QMainWindow.__init__(self)

        loadUi('ui/principal.ui', self)
        self.setWindowFlags(Qt.SplashScreen)

        self.minx.setCursor(Qt.PointingHandCursor)
        self.minx.setScaledContents(True)
        self.minx.setPixmap(QPixmap("img/min.ico"))

        self.maxb.setCursor(Qt.PointingHandCursor)
        self.maxb.setScaledContents(True)
        self.maxb.setPixmap(QPixmap("img/maxx.ico"))

        self.clos.setCursor(Qt.PointingHandCursor)
        self.clos.setScaledContents(True)
        self.clos.setPixmap(QPixmap("img/cierre.ico"))


        self.minx.mouseReleaseEvent = self.mini
        self.maxb.mouseReleaseEvent = self.maxx
        self.clos.mouseReleaseEvent = self.salir
#.........................................................................................
    def salir(self, event):
        sys.exit()

    def mini(self, event):
        self.setWindowState(Qt.WindowMinimized)

    def maxx(self, event):
        band = False
        if band:
            self.setWindowState(Qt.WindowMaximized)
            band = True
        else:
            self.setMinimumSize(900, 569)

            band = False



if __name__ == '__main__':
    app = QApplication(sys.argv)
    ap = Mast()
    ap.show()
    sys.exit(app.exec_())
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20160914/3b4b8f84/attachment.html>


More information about the PyQt mailing list