Exemplo n.º 1
0
    def __init__(self):
        super(Widget, self).__init__()

        layout = QVBoxLayout(self)

        self.gif = GifWidget(self, "../images/yin.gif")

        startBtn = QPushButton("开始", self)
        startBtn.setObjectName("startBtn")

        stopBtn = QPushButton("停止", self)
        stopBtn.setObjectName("stopBtn")

        changeBtn = QPushButton("改变第二个图", self)
        changeBtn.setObjectName("changeBtn")

        layout.addWidget(self.gif)
        layout.addWidget(startBtn)
        layout.addWidget(stopBtn)
        layout.addWidget(changeBtn)

        QMetaObject.connectSlotsByName(self)  # 通过objectname注册信号
Exemplo n.º 2
0
    def __init__(self):
        super(Widget, self).__init__()

        layout = QVBoxLayout(self)

        self.gif = GifWidget(self, "../images/yin.gif")

        startBtn = QPushButton("开始", self)
        startBtn.setObjectName("startBtn")

        stopBtn = QPushButton("停止", self)
        stopBtn.setObjectName("stopBtn")

        changeBtn = QPushButton("改变第二个图", self)
        changeBtn.setObjectName("changeBtn")

        layout.addWidget(self.gif)
        layout.addWidget(startBtn)
        layout.addWidget(stopBtn)
        layout.addWidget(changeBtn)

        QMetaObject.connectSlotsByName(self)    # 通过objectname注册信号
Exemplo n.º 3
0
class Widget(QWidget):

    def __init__(self):
        super(Widget, self).__init__()

        layout = QVBoxLayout(self)

        self.gif = GifWidget(self, "../images/yin.gif")

        startBtn = QPushButton("开始", self)
        startBtn.setObjectName("startBtn")

        stopBtn = QPushButton("停止", self)
        stopBtn.setObjectName("stopBtn")

        changeBtn = QPushButton("改变第二个图", self)
        changeBtn.setObjectName("changeBtn")

        layout.addWidget(self.gif)
        layout.addWidget(startBtn)
        layout.addWidget(stopBtn)
        layout.addWidget(changeBtn)

        QMetaObject.connectSlotsByName(self)    # 通过objectname注册信号

    @pyqtSlot()    # 这里主要是解决qt5和qt4的区别(不加这个会出现点击两次的效果)
    def on_startBtn_clicked(self):
        self.gif.start()

    @pyqtSlot()
    def on_stopBtn_clicked(self):
        self.gif.stop()

    @pyqtSlot()
    def on_changeBtn_clicked(self):
        fn, _ = QFileDialog.getOpenFileName(self, "选择动态图片", None, "Gif Files (*.gif)")
        if fn:
            self.gif.setPath(fn)
Exemplo n.º 4
0
class Widget(QWidget):
    def __init__(self):
        super(Widget, self).__init__()

        layout = QVBoxLayout(self)

        self.gif = GifWidget(self, "../images/yin.gif")

        startBtn = QPushButton("开始", self)
        startBtn.setObjectName("startBtn")

        stopBtn = QPushButton("停止", self)
        stopBtn.setObjectName("stopBtn")

        changeBtn = QPushButton("改变第二个图", self)
        changeBtn.setObjectName("changeBtn")

        layout.addWidget(self.gif)
        layout.addWidget(startBtn)
        layout.addWidget(stopBtn)
        layout.addWidget(changeBtn)

        QMetaObject.connectSlotsByName(self)  # 通过objectname注册信号

    @pyqtSlot()  # 这里主要是解决qt5和qt4的区别(不加这个会出现点击两次的效果)
    def on_startBtn_clicked(self):
        self.gif.start()

    @pyqtSlot()
    def on_stopBtn_clicked(self):
        self.gif.stop()

    @pyqtSlot()
    def on_changeBtn_clicked(self):
        fn, _ = QFileDialog.getOpenFileName(self, "选择动态图片", None,
                                            "Gif Files (*.gif)")
        if fn:
            self.gif.setPath(fn)