本文整理匯總了Python中PyQt5.QtCore.QPropertyAnimation.stop方法的典型用法代碼示例。如果您正苦於以下問題:Python QPropertyAnimation.stop方法的具體用法?Python QPropertyAnimation.stop怎麽用?Python QPropertyAnimation.stop使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt5.QtCore.QPropertyAnimation
的用法示例。
在下文中一共展示了QPropertyAnimation.stop方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Tab
# 需要導入模塊: from PyQt5.QtCore import QPropertyAnimation [as 別名]
# 或者: from PyQt5.QtCore.QPropertyAnimation import stop [as 別名]
class Tab(QObject):
def __init__(self, parent):
QObject.__init__(self, parent)
self._toolbar = parent
self.icon = None
self.text = ""
self.has_menu = False
self.enabled = True
self._fader = 0
self._animator = QPropertyAnimation(self)
self._animator.setPropertyName(b"fader")
self._animator.setTargetObject(self)
def fade_in(self):
self._animator.stop()
self._animator.setDuration(80)
self._animator.setEndValue(1)
self._animator.start()
def fade_out(self):
self._animator.stop()
self._animator.setDuration(160)
self._animator.setEndValue(0)
self._animator.start()
def _set_fader(self, value):
self._fader = value
self._toolbar.update()
def _get_fader(self):
return self._fader
fader = pyqtProperty(float, fget=_get_fader, fset=_set_fader)
示例2: NotifyWidget
# 需要導入模塊: from PyQt5.QtCore import QPropertyAnimation [as 別名]
# 或者: from PyQt5.QtCore.QPropertyAnimation import stop [as 別名]
class NotifyWidget(QWidget):
def __init__(self):
super().__init__()
self.layout = QVBoxLayout(self)
self.sub_widget = _NotifySubWidget(self)
self.layout.addWidget(self.sub_widget)
self.layout.setContentsMargins(0, 0, 0, 0)
self._exit_shortcut = QShortcut(QKeySequence(Qt.Key_Escape), self)
self._exit_shortcut.activated.connect(self.close)
self.setWindowFlags(Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint | Qt.Tool)
self.setAttribute(Qt.WA_TranslucentBackground)
self.setAttribute(Qt.WA_MacAlwaysShowToolWindow)
self.resize(width, height)
self.move(QApplication.desktop().width() - self.width() - 20, 40)
self.setLayout(self.layout)
self._animation = QPropertyAnimation(self, b'windowOpacity')
self._animation.setStartValue(0.8)
self._animation.setKeyValueAt(0.4, 1)
self._animation.setEndValue(0)
self._animation.setDuration(5000)
self._animation.finished.connect(self.close)
def show(self):
super().show()
self._animation.start()
def show_message(self, title, content, pixmap=None):
if not self.isVisible():
self.show()
self._animation.stop()
self._animation.setCurrentTime(0)
self._animation.start()
self.sub_widget.set_title(title)
self.sub_widget.set_content(content)
pixmap = pixmap if pixmap else QPixmap(WINDOW_ICON)
self.sub_widget.set_pixmap(pixmap)
def enterEvent(self, event):
self._animation.setCurrentTime(0)