python教程

窗口事件

发布日期:2020年11月23日 07:32
阅读:3574
作者:Python GUI编程网

窗口事件

00:00 / 01:23
1x
2x
1.5x
1.25x
1x
0.8x
0.5x

窗口事件

################################
# PyQt5中文网 - PyQt5全套视频教程 #
#    https://www.PyQt5.cn/     #
#         主讲: 村长            #
################################

from PyQt5.Qt import *
import sys

class Window(QWidget):
    def __init__(self):
        super().__init__()
        self.setWindowTitle("窗口事件")
        self.resize(600,500)
        self.func_list()

    # 窗口事件
    # def showEvent(self, QShowEvent):
    #     print('窗口打开')
    #
    # def closeEvent(self,QCloseEvent):
    #     print('窗口关闭')
    #
    # def moveEvent(self, QMoveEvent):
    #     print('窗口移动')
    #
    # def resizeEvent(self, QResizeEvent):
    #     print('窗口缩放')

    def func_list(self):
        self.func()


    def func(self):
        pass

if __name__ == '__main__':
    app = QApplication(sys.argv)
    window = Window()

    # window.setMouseTracking(True)

    window.show()
    sys.exit(app.exec_())