本文整理汇总了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)