tooltips.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:Mac-Python-3.X 作者: L1nwatch 项目源码 文件源码
def __init__(self):
        super(SortingBox, self).__init__()

        self.circlePath = QPainterPath()
        self.squarePath = QPainterPath()
        self.trianglePath = QPainterPath()
        self.shapeItems = []        

        self.previousPosition = QPoint()

        self.setMouseTracking(True)
        self.setBackgroundRole(QPalette.Base)

        self.itemInMotion = None

        self.newCircleButton = self.createToolButton("New Circle",
                QIcon(':/images/circle.png'), self.createNewCircle)
        self.newSquareButton = self.createToolButton("New Square",
                QIcon(':/images/square.png'), self.createNewSquare)
        self.newTriangleButton = self.createToolButton("New Triangle",
                QIcon(':/images/triangle.png'), self.createNewTriangle)

        self.circlePath.addEllipse(0, 0, 100, 100)
        self.squarePath.addRect(0, 0, 100, 100)

        x = self.trianglePath.currentPosition().x()
        y = self.trianglePath.currentPosition().y()
        self.trianglePath.moveTo(x + 120 / 2, y)
        self.trianglePath.lineTo(0, 100)
        self.trianglePath.lineTo(120, 100)
        self.trianglePath.lineTo(x + 120 / 2, y)

        self.setWindowTitle("Tooltips")
        self.resize(500, 300)

        self.createShapeItem(self.circlePath, "Circle",
                self.initialItemPosition(self.circlePath),
                self.initialItemColor())
        self.createShapeItem(self.squarePath, "Square",
                self.initialItemPosition(self.squarePath),
                self.initialItemColor())
        self.createShapeItem(self.trianglePath, "Triangle",
                self.initialItemPosition(self.trianglePath),
                self.initialItemColor())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号