如何使用pyqt4减少gif大小

时间:2018-12-11 17:35:38

标签: python pyqt4

这是我的示例代码,我想减小gif的大小,但是并没有改变,我尝试更改标签的大小,但这并不是减小gif的大小,

下面是我的示例代码:

import sys
from pyface.qt import QtGui, QtCore
class Settings(QtGui.QMainWindow):
    def __init__(self, parent=None):
        super(Settings, self).__init__(parent)
        self.w1 = QtGui.QDialog()
        self.vbox1 = QtGui.QVBoxLayout(self.w1)
        self.w1.setStyleSheet("QWidget {background-color:black;color:white}")
        self.label1 = QtGui.QLabel()
        self.label1.setText("Please Wait while It Is Connecting...")
        self.label1.setFont(QtGui.QFont("Times", 20,weight=QtGui.QFont.Bold))        
        self.label2 = QtGui.QLabel()
        movie = QtGui.QMovie("./img/loading.gif")
        self.label2.setMovie(movie)
        # movie.scaledSize()
        self.label2.resize(30,30)
        movie.start()

        self.ani_hbox = QtGui.QHBoxLayout()
        self.ok = QtGui.QPushButton("Ok")

        self.cancel = QtGui.QPushButton("Cancel")
        self.cancel.clicked.connect(self.w1.close)
        self.ani_hbox.addWidget(self.cancel)
        self.ani_hbox.addWidget(self.ok)        
        self.vbox1.addWidget(self.label1)        
        self.vbox1.addWidget(self.label2)
        self.vbox1.addLayout(self.ani_hbox)
        self.w1.resize(50,50)
        self.w1.exec_()
def main():
    app = QtGui.QApplication(sys.argv)
    ex = Settings()
    # ex.show()
    sys.exit(app.exec_())

if __name__ == '__main__':
    main()

0 个答案:

没有答案