【发布时间】:2017-01-18 00:31:27
【问题描述】:
我正在尝试在我的代码后面添加一个 gif,我似乎无法让它在这里工作是我正在使用的代码
import sys
import webbrowser
import random
import time
import os
import subprocess
from PyQt4.QtCore import QSize, QTimer
from PyQt4.QtGui import QApplication, QMainWindow, QPushButton, QWidget, QIcon, QLabel, QPainter, QPixmap, QMessageBox, QAction, QKeySequence, QFont, QFontMetrics, QMovie
from PyQt4 import QtGui
class UIWindow(QWidget):
def __init__(self, parent=None):
super(UIWindow, self).__init__(parent)
self.resize(QSize(600, 750))
self.ToolsBTN = QPushButton('tab', self)
self.ToolsBTN.resize(100,40)
self.ToolsBTN.move(60, 300)
self.CPS = QPushButton('tab1', self)
self.CPS.resize(100,40)
self.CPS.move(130,600)
self.Creator = QPushButton('tab2', self)
self.Creator.resize(100,40)
self.Creator.move(260, 50)
class MainWindow(QMainWindow,):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.setGeometry(50, 50, 600, 750)
self.setFixedSize(600, 750)
self.startUIWindow()
def startUIWindow(self):
self.Window = UIWindow(self)
self.setWindowTitle("My Program")
self.show()
if __name__ == '__main__':
app = QApplication(sys.argv)
w = MainWindow()
sys.exit(app.exec_())
这就是我现在所拥有的一切,我正试图让我的 Dance.gif 在后面播放,但如果有人能帮我解决这个问题,这对我不起作用,那就太棒了!
【问题讨论】:
-
“它不适合我”是什么意思?在代码中,您甚至没有尝试将 gif 设置为背景。