本文整理汇总了Python中PyQt5.QtCore.QPropertyAnimation.setTargetObject方法的典型用法代码示例。如果您正苦于以下问题:Python QPropertyAnimation.setTargetObject方法的具体用法?Python QPropertyAnimation.setTargetObject怎么用?Python QPropertyAnimation.setTargetObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore.QPropertyAnimation
的用法示例。
在下文中一共展示了QPropertyAnimation.setTargetObject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Tab
# 需要导入模块: from PyQt5.QtCore import QPropertyAnimation [as 别名]
# 或者: from PyQt5.QtCore.QPropertyAnimation import setTargetObject [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: QPropertyAnimation
# 需要导入模块: from PyQt5.QtCore import QPropertyAnimation [as 别名]
# 或者: from PyQt5.QtCore.QPropertyAnimation import setTargetObject [as 别名]
from PyQt5.QtCore import QPropertyAnimation, QEasingCurve
animation = QPropertyAnimation()
animation.setTargetObject()
animation.setStartValue(0)
animation.setEndValue(1000)
animation.setDuration(1000)
animation.setEasingCurve(QEasingCurve.InOutQuad)
animation.start()
示例3: __init__
# 需要导入模块: from PyQt5.QtCore import QPropertyAnimation [as 别名]
# 或者: from PyQt5.QtCore.QPropertyAnimation import setTargetObject [as 别名]
#.........这里部分代码省略.........
def appExit(self, event):
if self.devMode == False:
QtWidgets.QMessageBox.information(None, "bluer", "开发者模式开启")
self.devMode = True
else:
QtWidgets.QMessageBox.information(None, "bluer", "开发者模式关闭")
self.devMode = False
def avataEdit(self, event):
openDlg = QtWidgets.QFontDialog()
openDlg.open()
def setupUi2(self):
#setup event handling
self.sideButtons = [self.ui.lb1, self.ui.lb2, self.ui.lb3, self.ui.lb4]
self.ui.lb_exit.mousePressEvent = self.appExit
self.setupAnimes()
self.setupSideButtons()
self.refreshInfo()
#setup tray
self.icon = QIcon("res/logo-tray.png")
self.trayIcon = QSystemTrayIcon()
self.trayIcon.setIcon(self.icon)
self.trayIcon.activated.connect(self.onTrayClicked)
self.trayIcon.show()
#setup the info edit
self.ui.lb_avata.mousePressEvent = self.avataEdit
def setupAnimes(self):
self.shiftAnime1 = QPropertyAnimation()
self.shiftAnime1.setTargetObject(self.ui.widget1)
self.shiftAnime1.setPropertyName("geometry".encode())
self.shiftAnime1.setDuration(400)
self.shiftAnime1.setStartValue(QRect(177, 29, 0, 571))
self.shiftAnime1.setEndValue(QRect(177, 29, 623, 571))
self.shiftAnime2 = QPropertyAnimation()
self.shiftAnime2.setTargetObject(self.ui.widget2)
self.shiftAnime2.setPropertyName("geometry".encode())
self.shiftAnime2.setDuration(400)
self.shiftAnime2.setStartValue(QRect(800, 29, 0, 571))
self.shiftAnime2.setEndValue(QRect(177, 29, 623, 571))
self.shiftAnime3 = QPropertyAnimation()
self.shiftAnime3.setTargetObject(self.ui.widget3)
self.shiftAnime3.setPropertyName("geometry".encode())
self.shiftAnime3.setDuration(400)
self.shiftAnime3.setStartValue(QRect(800, 29, 623, 571))
self.shiftAnime3.setEndValue(QRect(177, 29, 623, 571))
self.shiftAnime4 = QPropertyAnimation()
self.shiftAnime4.setTargetObject(self.ui.widget4)
self.shiftAnime4.setPropertyName("geometry".encode())
self.shiftAnime4.setDuration(400)
self.shiftAnime4.setStartValue(QRect(800, 29, 623, 571))
self.shiftAnime4.setEndValue(QRect(177, 29, 623, 571))
self.selectedWidget = self.ui.widget1
def setSlideMid(self, bt):
if self.selectedSideButton != bt:
bt.setStyleSheet(slide_bt_mid)