def submit(self): _movie = QMovie(os.getcwd()+'/loading.gif') _movie.setScaledSize(QSize(50, 50)) self.text.setMovie(_movie) _movie.start() t = threading.Thread(target=self.processEmployee) t.start()
def stackWallet(self): self.setButton(self.ui.btn_left, function=self.stackWalletServices, text='بازگشت', icon='images/icon/back.png', show=True) self.setButton(self.ui.btn_right, show=False) self.ui.lbl_notification.hide() gif_wallet = QMovie("animations/wallet.gif") gif_wallet.setScaledSize(QSize().scaled(256, 256, Qt.KeepAspectRatio)) self.ui.lbl_gif_wallet.setMovie(gif_wallet) gif_wallet.start() self.ui.lbl_wallet.setText(str( ("{:,.0f}").format(self.user['wallet']))) self.ui.Stack.setCurrentWidget(self.ui.pageWallet)
class xASL_ImagePlayer(QLabel): def __init__(self, filepath, parent=None, alignment=Qt.AlignLeft, h_offset=0, v_offset=5, initial_movie_size=None): """ A modified QLabel which features a GIF movie that can be played Parameters: • filepath: The filepath to the .gif file which will be played • parent: The parent of this widget • alignment: The alignment of the movie w.r.t the label itself • h_offset: When resizing based on a buddy widget, the additional horizontal size that should be given • v_offset: When resizing based on a buddy widget, the additional vertical size that should be given • initial_movie_size: None, QSize or a 2-element tuple to indicate the initial pixel dimensions that the movie should be set to """ super(xASL_ImagePlayer, self).__init__(parent=parent) self.h_offset, self.v_offset = h_offset, v_offset self.setContentsMargins(0, 0, 0, 0) self.setAlignment(alignment) # Load the file into a QMovie with the appropriate size self.movie = QMovie(str(filepath), QByteArray(), self) self.movie.setCacheMode(QMovie.CacheAll) self.movie.setSpeed(100) self.setMovie(self.movie) self.ping() if initial_movie_size is not None: if isinstance(initial_movie_size, tuple): initial_movie_size = QSize(*initial_movie_size) self.movie.setScaledSize(initial_movie_size) def ping(self): self.movie.start() self.movie.stop() self.movie.jumpToFrame(0) @Slot(int, int) def listen_resize(self, width, height): self.movie.setScaledSize( QSize(width + self.h_offset, height + self.v_offset)) self.ping()
def main(): # print('minha main') movie = QMovie('EYE_WALLEroxo.gif') ui.label_2.setMovie(movie) movie.setSpeed(160) rect = ui.label_2.geometry() size = QSize(min(rect.width(), rect.height()), min(rect.width(), rect.height())) movie.setScaledSize(size) movie.start() movieLoading(False) inicializarWarningMSG(False) ui.pushButton_2.setEnabled(False) ui.pushButton.clicked.connect(procurar_diretorio) ui.pushButton_2.clicked.connect(converter_py_exe)