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.
Asked
Active
Viewed 1,125 times
0
-
1possible duplicate of [Qt loading indicator widget](http://stackoverflow.com/questions/26958644/qt-loading-indicator-widget) – Mailerdaimon Feb 03 '15 at 10:06
-
Definitely a duplicate, even the answers are completely identical. – NoDataDumpNoContribution Feb 04 '15 at 09:29
1 Answers
2
Solution 1: Havn't tried the PyQt version yet but here you go : https://github.com/ertanguven/desktop-service/blob/master/pds/qprogressindicator.py
Which is based on : https://github.com/mojocorp/QProgressIndicator
Solution 2: Using QMovie to load a .gif file
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.
http://pyqt.sourceforge.net/Docs/PyQt4/qprogressdialog.html
Bonus: Loader.gif

DrHaze
- 1,318
- 10
- 22