當前位置: 首頁>>代碼示例>>Python>>正文


Python QPropertyAnimation.setTargetObject方法代碼示例

本文整理匯總了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)
開發者ID:ninja-ide,項目名稱:ninja-ide,代碼行數:36,代碼來源:ui_tools.py

示例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()
開發者ID:PixelStereo,項目名稱:lekture,代碼行數:13,代碼來源:animationn.py

示例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)
開發者ID:blackskygg,項目名稱:jielu,代碼行數:70,代碼來源:blueApp.py


注:本文中的PyQt5.QtCore.QPropertyAnimation.setTargetObject方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。