from PyQt5 import QtCore, QtGui, QtWidgets
from threading import Thread
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
import threading
import sys
class Example(QMainWindow):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
btn1 = QPushButton("Button 1", self)
btn1.move(30, 50)
btn1.clicked.connect(self.playGif)
self.setGeometry(300, 300, 290, 150)
self.setWindowTitle("Event sender")
def buttonClicked(self):
Thread(target = self.playGif).start()
# @pyqtSlot()
def playGif(self):
self.cams = WindowGif()
self.cams.show()
class WindowGif(QDialog):
def __init__(self, parent = None):
super().__init__(parent)
self.initUI()
def initUI(self):
self.movie_screen = QLabel(self)
self.setWindowFlags(Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint | Qt.MSWindowsFixedSizeDialogHint)
self.movie_screen.setWindowFlags(Qt.MSWindowsFixedSizeDialogHint)
self.setAttribute(Qt.WA_TranslucentBackground)
self.movie_screen.setAttribute(Qt.WA_TranslucentBackground)
self.movie = QMovie("loading.gif")
self.movie_screen.setMovie(self.movie)
self.movie.start()
self.movie_screen.adjustSize()
# ff1 = f1()
# ff2 = f2()
# Thread(target = ff1.func1()).start()
# Thread(target = ff2.func2()).start()
if __name__ == "__main__":
app = QApplication(sys.argv)
ex = Example()
ex.show()
sys.exit(app.exec_())