简体   繁体   English

如何创建或在PySide中已经有旋转对话框,可以在服务器请求结束后使用该对话框?

[英]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()

Source 资源

Solution 3 (this is not what you want): A Progress Bar. 解决方案3(这不是您想要的):进度栏。 QProgressDialog 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.

相关问题 Pyside:我怎么知道哪个线程发出了“完成”信号? - Pyside: How can i know which thread emitted the signal “finished”? 如何将Qt Designer中的自定义小部件与PySide一起使用? - How can I use a custom widget from Qt Designer with PySide? 如何创建可以在“合理”环境中运行的PyQt / PySide应用程序包? - How can I create a package of a PyQt/PySide application which can be expected to run in “reasonable” environments? 如何创建可以使用“get”的 class? - How to create class from which I can use “get”? 当我将它们映射在一起时,为什么不能以Pyside形式看到模型中的数据? - Why can't I see the data from my model in this Pyside form while I did map them together? KivyMD//Python 如何创建一个加载对话框(弹出)显示一个纺车同时代码在后台运行另一个函数 - KivyMD//Python How to create a loading dialog box (pop-up) that displays a spinning wheel while the code runs another function in the background 如果请求在 X 毫秒后未完成,我如何创建同时例程 - How can i create a simultaneous routine if a request isn't finished after X milliseconds 如何在pyinstaller环境中使ipython RichIPythonWidget使用pyside? - How can i make ipythons RichIPythonWidget use pyside in a pyinstaller environment? 如何在 PySide2 中正确使用 CSS - How can I properly use CSS inside PySide2 如何使用PySide快速调整PNG的大小? - How can I use PySide to quickly resize a PNG?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM