[英]How to create or is there already spinning dialog in PySide which I can use while my request from server is finished ?
How to create or is there already spinning dialog which I can use while my request from server is finished ? 服务器请求完成后,如何创建对话框或已经可以使用的对话框? I have to download file and in that time I have to notify user that some action is executing. 我必须下载文件,并且在那时候我必须通知用户正在执行某些操作。
Solution 1: Havn't tried the PyQt version yet but here you go : https://github.com/ertanguven/desktop-service/blob/master/pds/qprogressindicator.py 解决方案1:还没有尝试过PyQt版本,但是您可以使用: https : //github.com/ertanguven/desktop-service/blob/master/pds/qprogressindicator.py
Which is based on : https://github.com/mojocorp/QProgressIndicator 这是基于: https : //github.com/mojocorp/QProgressIndicator
Solution 2: Using QMovie to load a .gif file 解决方案2:使用QMovie加载.gif文件
class ImagePlayer(QtGui.QWidget):
def __init__(self, filename, title, parent=None):
QtGui.QWidget.__init__(self, parent)
# Load the file into a QMovie
self.movie = QtGui.QMovie(filename, QByteArray(), self)
size = self.movie.scaledSize()
self.setGeometry(200, 200, size.width(), size.height())
self.setWindowTitle(title)
self.movie_screen = QtGui.QLabel()
# Make label fit the gif
self.movie_screen.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
self.movie_screen.setAlignment(Qt.AlignCenter)
# Create the layout
main_layout = QtGui.QVBoxLayout()
main_layout.addWidget(self.movie_screen)
self.setLayout(main_layout)
# Add the QMovie object to the label
self.movie.setCacheMode(QMovie.CacheAll)
self.movie.setSpeed(100)
self.movie_screen.setMovie(self.movie)
self.movie.start()
def run():
global my_window
try:
my_window.close()
my_window.deleteLater()
except: pass
my_window = ImagePlayer(r'Path/To/loader.gif', "Hello")
my_window.show()
run()
Solution 3 (this is not what you want): A Progress Bar. 解决方案3(这不是您想要的):进度栏。 http://pyqt.sourceforge.net/Docs/PyQt4/qprogressdialog.html http://pyqt.sourceforge.net/Docs/PyQt4/qprogressdialog.html
Bonus: Loader.gif 奖励: Loader.gif
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.