本文整理汇总了Python中PyQt4.QtGui.QGraphicsSimpleTextItem.setMatrix方法的典型用法代码示例。如果您正苦于以下问题:Python QGraphicsSimpleTextItem.setMatrix方法的具体用法?Python QGraphicsSimpleTextItem.setMatrix怎么用?Python QGraphicsSimpleTextItem.setMatrix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QGraphicsSimpleTextItem
的用法示例。
在下文中一共展示了QGraphicsSimpleTextItem.setMatrix方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt4.QtGui import QGraphicsSimpleTextItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsSimpleTextItem import setMatrix [as 别名]
def __init__(self, dataDir = "", parent = None):
QWidget.__init__(self, parent)
self.renderer = QSvgRenderer(dataDir + "poker.svg")
self.scene = QGraphicsScene()
self.chat = QGraphicsSimpleTextItem()
self.table = QGraphicsSvgItem(dataDir + "poker.svg")
self.table.setSharedRenderer(self.renderer)
self.table.setElementId("table")
self.table.setMatrix(self.renderer.matrixForElement("transform_table"))
self.scene.addItem(self.chat)
self.scene.addItem(self.table)
self.board = []
for i in range(5):
card = AnimatedGraphicsSvgItem(dataDir + "svg-cards.svg", self.table)
card.setElementId("back")
parent = self.renderer.matrixForElement("transform_table")
child = self.renderer.matrixForElement("transform_card%i" % i)
cardMatrix = child.translate(-parent.dx(), -parent.dy())
card.setMatrix(cardMatrix)
#card.setFlag(QGraphicsSvgItem.ItemIsMovable, True)
card.scale(0.5, 0.5)
card.hide()
self.scene.addItem(card)
self.board.append(card)
self.seats = []
self.names = []
self.moneys = []
self.bets = []
for i in range(10):
seat = SeatItem()
def seatClickedEvent(seat = i):
seatClickedCallback = self.seatClicked
seatClickedCallback(seat)
seat.event = seatClickedEvent
seat.setSharedRenderer(self.renderer)
seat.setElementId("seat")
seat.setMatrix(self.renderer.matrixForElement("transform_seat%i" % i))
self.scene.addItem(seat)
self.seats.append(seat)
name = QGraphicsSimpleTextItem(seat)
name.setMatrix(self.renderer.matrixForElement("seat_name"))
self.scene.addItem(name)
self.names.append(name)
money = QGraphicsSimpleTextItem(seat)
money.setMatrix(self.renderer.matrixForElement("seat_money"))
self.scene.addItem(money)
self.moneys.append(money)
bet = QGraphicsSimpleTextItem()
bet.setMatrix(self.renderer.matrixForElement("transform_bet%i" % i))
self.scene.addItem(bet)
self.bets.append(bet)
self.pots = []
for i in range(9):
pot = QGraphicsSimpleTextItem()
pot.setMatrix(self.renderer.matrixForElement("transform_pot%i" %i))
self.scene.addItem(pot)
self.pots.append(pot)
self.view = QGraphicsView(self)
self.view.setScene(self.scene)
self.view.resize(800, 600)
self.fold = ActionItem()
self.fold.setText("fold")
self.fold.setPos(0, 550)
self.scene.addItem(self.fold)
self.fold.event = lambda: self.foldClicked()
self.check = ActionItem()
self.check.setText("check")
self.check.setPos(50, 550)
self.scene.addItem(self.check)
self.check.event = lambda: self.checkClicked()
self.call = ActionItem()
self.call.setText("call")
self.call.setPos(100, 550)
self.scene.addItem(self.call)
self.call.event = lambda: self.callClicked()
self.bet = ActionItem()
self.bet.setText("bet")
self.bet.setPos(150, 550)
self.scene.addItem(self.bet)
self.bet.event = lambda: self.betClicked()