PyQt/Demo/GifCursor.py

47 lines
1.1 KiB
Python
Raw Permalink Normal View History

2020-03-13 00:30:54 +08:00
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Created on 2020年3月13日
@author: Irony
2021-07-13 14:52:26 +08:00
@site: https://pyqt.site , https://github.com/PyQt5
2020-03-13 00:30:54 +08:00
@email: 892768447@qq.com
@file: Demo.GifCursor
@description:
"""
2021-07-13 14:52:26 +08:00
try:
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton, QApplication
except ImportError:
from PySide2.QtWidgets import QWidget, QVBoxLayout, QPushButton, QApplication
2020-03-13 00:30:54 +08:00
2021-07-13 14:52:26 +08:00
from Lib.QCursorGif import QCursorGif
2020-03-13 00:30:54 +08:00
class Window(QWidget, QCursorGif):
def __init__(self, *args, **kwargs):
super(Window, self).__init__(*args, **kwargs)
# 设置忙碌光标图片数组
self.initCursor(['Data/Images/Cursors/%d.png' %
i for i in range(8)], self)
self.setCursorTimeout(100)
layout = QVBoxLayout(self)
layout.addWidget(QPushButton(
'start busy', self, clicked=self.startBusy))
layout.addWidget(QPushButton(
'stop busy', self, clicked=self.stopBusy))
if __name__ == '__main__':
import sys
import cgitb
2021-07-13 14:52:26 +08:00
cgitb.enable(format='text')
2020-03-13 00:30:54 +08:00
app = QApplication(sys.argv)
w = Window()
w.show()
sys.exit(app.exec_())