blob: 40c8d64a360aaaac49a0c4429373c35029a3abe5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
from PySide.QtCore import *
from PySide.QtGui import *
class Ball(QGraphicsEllipseItem):
def __init__(self, d, parent=None):
super(Ball, self).__init__(0, 0, d, d, parent)
self.vel = QPointF(0,0) #commenting this out prevents the crash
class Foo(QGraphicsView):
def __init__(self):
super(Foo, self).__init__(None)
self.scene = QGraphicsScene(self.rect())
self.setScene(self.scene)
self.scene.addItem(Ball(10))
if __name__ == "__main__":
import sys
app = QApplication(sys.argv)
w = Foo()
w.show()
w.raise_()
QTimer.singleShot(0, w.close)
sys.exit(app.exec_())
|