当前位置: 首页>>代码示例>>Python>>正文


Python QGraphicsSimpleTextItem.setMatrix方法代码示例

本文整理汇总了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()
开发者ID:arem,项目名称:poker-network,代码行数:82,代码来源:qpokerwidget.py


注:本文中的PyQt4.QtGui.QGraphicsSimpleTextItem.setMatrix方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。