本文整理汇总了Python中PyQt4.QtGui.QGraphicsEllipseItem.setToolTip方法的典型用法代码示例。如果您正苦于以下问题:Python QGraphicsEllipseItem.setToolTip方法的具体用法?Python QGraphicsEllipseItem.setToolTip怎么用?Python QGraphicsEllipseItem.setToolTip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QGraphicsEllipseItem
的用法示例。
在下文中一共展示了QGraphicsEllipseItem.setToolTip方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: point
# 需要导入模块: from PyQt4.QtGui import QGraphicsEllipseItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsEllipseItem import setToolTip [as 别名]
def point(scene, x, y, color='black', fill='black', diam=10, toolTip=None):
item = QGraphicsEllipseItem(x-diam/2, y-diam/2, diam, diam)
brush = QBrush(QColor(color), style=Qt.SolidPattern)
item.setBrush(brush)
if toolTip:
item.setToolTip(toolTip)
scene.addItem(item)
示例2: GPendulum
# 需要导入模块: from PyQt4.QtGui import QGraphicsEllipseItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsEllipseItem import setToolTip [as 别名]
class GPendulum(Graphics.Items.ItemGroupBase):
def _setup(self):
self.rod = QGraphicsLineItem(QLineF(0, 0, 0, 100))
p = QPen(QColor(100, 100, 100))
p.setWidth(5)
self.rod.setPen(p)
self.rod.setToolTip('This is the rod of the pendulum')
self.ball = QGraphicsEllipseItem(QRectF(-20, 80, 40, 40))
b = QBrush(Qt.SolidPattern)
b.setColor(QColor(0, 255, 0))
self.ball.setBrush(b)
self.ball.setToolTip('This is the ball of the pendulum where the mass is concentrated')
self.addToGroup(self.rod)
self.addToGroup(self.ball)
self.setFlags(QGraphicsItem.ItemIsSelectable)
def setProperties(self, q):
self.properties = q
def contextMenuEvent(self, e):
e.accept()
m = QMenu()
p = m.addAction("Properties")
a = m.exec_(e.screenPos())
if a == p:
dlg = SimTools.RichTypes.Qt4Widgets.SimpleRichTypesDialog(mainWin, 'Pendulum properties',
text='Change physical properties', scrolling=False)
dlg.addRichTypes(self.properties)
dlg.exec_()
示例3: constructPieChart
# 需要导入模块: from PyQt4.QtGui import QGraphicsEllipseItem [as 别名]
# 或者: from PyQt4.QtGui.QGraphicsEllipseItem import setToolTip [as 别名]
def constructPieChart(self, distrib, numbs):
pie = QGraphicsItemGroup()
totArc = 0
for j, num, dist in reversed(zip(range(len(numbs)), numbs, distrib)):
arc = QGraphicsEllipseItem(-self.pieWidth/2, -self.pieWidth/2, self.pieWidth, self.pieHeight)
arc.setPen(QPen(QColor(0, 0, 0), 1, Qt.SolidLine))
arc.setBrush(QBrush(self.discPalette[j]))
arc.setToolTip("%s: %.3f" % (self.attributes[self.selectedAttributes[j]][0], num) + (" (%2.1f%%)" % (dist/self.barHeight*100) if self.normalize else ""))
arc.setStartAngle(totArc)
arc.setSpanAngle(dist * 2880 / self.barHeight)
pie.addToGroup(arc)
totArc += dist * 2880 / self.barHeight
return pie