本文整理匯總了Python中textbutton.TextButton.pos方法的典型用法代碼示例。如果您正苦於以下問題:Python TextButton.pos方法的具體用法?Python TextButton.pos怎麽用?Python TextButton.pos使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類textbutton.TextButton
的用法示例。
在下文中一共展示了TextButton.pos方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: MenuManager
# 需要導入模塊: from textbutton import TextButton [as 別名]
# 或者: from textbutton.TextButton import pos [as 別名]
#.........這裏部分代碼省略.........
def createLowLeftButton(self, label, type, movieIn, movieOut, movieShake, menuString=""):
button = TextButton(label, TextButton.RIGHT, type, self.window.scene,
self.window.mainSceneRoot, TextButton.PANEL)
if menuString:
button.setMenuString(menuString)
button.setRecursiveVisible(False)
button.setZValue(10)
iw = button.sceneBoundingRect().width()
xOffset = 15
# Create in-animation.
buttonIn = DemoItemAnimation(button, DemoItemAnimation.ANIM_IN)
buttonIn.setDuration(1800 * Colors.animSpeedButtons)
buttonIn.setStartPos(QtCore.QPointF(-iw, Colors.contentStartY + Colors.contentHeight - 35))
buttonIn.setPosAt(0.5, QtCore.QPointF(-iw, Colors.contentStartY + Colors.contentHeight - 35))
buttonIn.setPosAt(0.7, QtCore.QPointF(xOffset, Colors.contentStartY + Colors.contentHeight - 35))
buttonIn.setPosAt(1.0, QtCore.QPointF(xOffset, Colors.contentStartY + Colors.contentHeight - 26))
movieIn.append(buttonIn)
# Create out-animation.
buttonOut = DemoItemAnimation(button, DemoItemAnimation.ANIM_OUT)
buttonOut.hideOnFinished = True
buttonOut.setDuration(400 * Colors.animSpeedButtons)
buttonOut.setStartPos(QtCore.QPointF(xOffset, Colors.contentStartY + Colors.contentHeight - 26))
buttonOut.setPosAt(1.0, QtCore.QPointF(-iw, Colors.contentStartY + Colors.contentHeight - 26))
movieOut.append(buttonOut)
if movieShake is not None:
shakeAnim = DemoItemAnimation(button, DemoItemAnimation.ANIM_UNSPECIFIED)
shakeAnim.timeline.setCurveShape(QtCore.QTimeLine.LinearCurve)
shakeAnim.setDuration(650)
shakeAnim.setStartPos(buttonIn.posAt(1.0))
shakeAnim.setPosAt(0.60, buttonIn.posAt(1.0))
shakeAnim.setPosAt(0.70, buttonIn.posAt(1.0) + QtCore.QPointF(-3, 0))
shakeAnim.setPosAt(0.80, buttonIn.posAt(1.0) + QtCore.QPointF(2, 0))
shakeAnim.setPosAt(0.90, buttonIn.posAt(1.0) + QtCore.QPointF(-1, 0))
shakeAnim.setPosAt(1.00, buttonIn.posAt(1.0))
movieShake.append(shakeAnim)
def createLowRightButton(self, label, type, movieIn, movieOut, movieShake):
item = TextButton(label, TextButton.RIGHT, type, self.window.scene,
self.window.mainSceneRoot, TextButton.PANEL)
item.setRecursiveVisible(False)
item.setZValue(10)
sw = self.window.scene.sceneRect().width()
xOffset = 70
# Create in-animation.
anim = DemoItemAnimation(item, DemoItemAnimation.ANIM_IN)
anim.setDuration(1800 * Colors.animSpeedButtons)
anim.setStartPos(QtCore.QPointF(sw, Colors.contentStartY + Colors.contentHeight - 35))
anim.setPosAt(0.5, QtCore.QPointF(sw, Colors.contentStartY + Colors.contentHeight - 35))
anim.setPosAt(0.7, QtCore.QPointF(xOffset + 535, Colors.contentStartY + Colors.contentHeight - 35))
anim.setPosAt(1.0, QtCore.QPointF(xOffset + 535, Colors.contentStartY + Colors.contentHeight - 26))
movieIn.append(anim)
# Create out-animation.
anim = DemoItemAnimation(item, DemoItemAnimation.ANIM_OUT)
anim.hideOnFinished = True
anim.setDuration(400 * Colors.animSpeedButtons)
anim.setStartPos(QtCore.QPointF(xOffset + 535, Colors.contentStartY + Colors.contentHeight - 26))
anim.setPosAt(1.0, QtCore.QPointF(sw, Colors.contentStartY + Colors.contentHeight - 26))
movieOut.append(anim)
示例2: MenuManager
# 需要導入模塊: from textbutton import TextButton [as 別名]
# 或者: from textbutton.TextButton import pos [as 別名]
#.........這裏部分代碼省略.........
xOffset = 230.0
infoIn = DemoItemAnimation(item, DemoItemAnimation.ANIM_IN)
infoIn.setDuration(650)
infoIn.setStartValue(QPointF(self.window.scene.sceneRect().width(), Colors.contentStartY))
infoIn.setKeyValueAt(0.60, QPointF(xOffset, Colors.contentStartY))
infoIn.setKeyValueAt(0.70, QPointF(xOffset + 20, Colors.contentStartY))
infoIn.setKeyValueAt(0.80, QPointF(xOffset, Colors.contentStartY))
infoIn.setKeyValueAt(0.90, QPointF(xOffset + 7, Colors.contentStartY))
infoIn.setEndValue(QPointF(xOffset, Colors.contentStartY))
movie_in.append(infoIn)
infoOut = DemoItemAnimation(item, DemoItemAnimation.ANIM_OUT)
infoOut.setCurveShape(QEasingCurve.InQuad)
infoOut.setDuration(300)
infoOut.setHideOnFinished(True)
infoOut.setStartValue(QPointF(xOffset, Colors.contentStartY))
infoOut.setEndValue(QPointF(-600, Colors.contentStartY))
movie_out.append(infoOut)
def createTicker(self):
if Colors.noTicker:
return
movie_in = self.score.insertMovie('ticker')
movie_out = self.score.insertMovie('ticker -out')
movie_activate = self.score.insertMovie('ticker -activate')
movie_deactivate = self.score.insertMovie('ticker -deactivate')
self.ticker = ItemCircleAnimation()
self.ticker.setZValue(50)
self.ticker.hide()
# Move ticker in.
qtendpos = 485
qtPosY = 120
self.tickerInAnim = DemoItemAnimation(self.ticker,
DemoItemAnimation.ANIM_IN)
self.tickerInAnim.setDuration(500)
self.tickerInAnim.setStartValue(QPointF(self.window.scene.sceneRect().width(), Colors.contentStartY + qtPosY))
self.tickerInAnim.setKeyValueAt(0.60, QPointF(qtendpos, Colors.contentStartY + qtPosY))
self.tickerInAnim.setKeyValueAt(0.70, QPointF(qtendpos + 30, Colors.contentStartY + qtPosY))
self.tickerInAnim.setKeyValueAt(0.80, QPointF(qtendpos, Colors.contentStartY + qtPosY))
self.tickerInAnim.setKeyValueAt(0.90, QPointF(qtendpos + 5, Colors.contentStartY + qtPosY))
self.tickerInAnim.setEndValue(QPointF(qtendpos, Colors.contentStartY + qtPosY))
movie_in.append(self.tickerInAnim)
# Move ticker out.
qtOut = DemoItemAnimation(self.ticker, DemoItemAnimation.ANIM_OUT)
qtOut.setHideOnFinished(True)
qtOut.setDuration(500)
qtOut.setStartValue(QPointF(qtendpos, Colors.contentStartY + qtPosY))
qtOut.setEndValue(QPointF(self.window.scene.sceneRect().width() + 700, Colors.contentStartY + qtPosY))
movie_out.append(qtOut)
# Move ticker in on activate.
qtActivate = DemoItemAnimation(self.ticker)
qtActivate.setDuration(400)
qtActivate.setStartValue(QPointF(self.window.scene.sceneRect().width(), Colors.contentStartY + qtPosY))
qtActivate.setKeyValueAt(0.60, QPointF(qtendpos, Colors.contentStartY + qtPosY))
qtActivate.setKeyValueAt(0.70, QPointF(qtendpos + 30, Colors.contentStartY + qtPosY))
qtActivate.setKeyValueAt(0.80, QPointF(qtendpos, Colors.contentStartY + qtPosY))
qtActivate.setKeyValueAt(0.90, QPointF(qtendpos + 5, Colors.contentStartY + qtPosY))
qtActivate.setEndValue(QPointF(qtendpos, Colors.contentStartY + qtPosY))
movie_activate.append(qtActivate)
# Move ticker out on deactivate.