qgraphicsrecitem移动qgraphicscen

2024-04-18 09:40:17 发布

您现在位置:Python中文网/ 问答频道 /正文

此代码http://pastebin.com/XGWDyRd1

在场景中绘制一个矩形。 当我移动它时,它不会移动光标,并且会跳到某个地方。 我做错什么了


Tags: 代码comhttp地方场景绘制矩形光标
1条回答
网友
1楼 · 发布于 2024-04-18 09:40:17

打字错误

class MyRect(QtGui.QGraphicsRectItem):
    def mousePressEvent(self, event):
        print 'press event'    
        super(MyRect, self).mousePressEvent(event)

    def mouseReleaseEvent(self, event):
        print 'press release'  
        super(MyRect, self).mouseReleaseEvent(event)

相关问题 更多 >