Good day all,

Here is the scenario....

class MainWindow(QtGui.QMainWindow):
    def __init__(self, parent=None):
        QtGui.QMainWindow.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.scene = QtGui.QGraphicsScene(self)
        self.scene.setSceneRect(0, 0, 130, 257)
        self.ui.graphicsView.setScene(self.scene)
        .........
        ......
        ....
    def createUserTile(self, nick, ip):
        self.item = Item(nick)
        self.scene.addItem(self.item)
        self.anim = QtCore.QPropertyAnimation(self.item, 'pos')
        self.anim.setEasingCurve(QtCore.QEasingCurve.OutBounce)
        self.anim.setStartValue(QtCore.QPointF(-150, 1))
        self.anim.setEndValue(QtCore.QPointF(4, 1))
        self.anim.setDuration(1500)
        self.anim.start()

class Client(asyncore.dispatcher, QtCore.QThread):
    def __init__(self, parent=None):
        asyncore.dispatcher.__init__(self)
        QtCore.QThread.__init__(self,parent)
        self.create_socket(socket.AF_INET, socket.SOCK_STREAM)
        self.set_reuse_addr()
        self.connect((SERVER,PORT))
    def run(self):
        asyncore.loop()
    def handle_connect(self):
        request_handler(self)

app = QtGui.QApplication(sys.argv)
myapp = MainWindow()
myapp.show()
myclient = Client()
myclient.start()
gobject.threads_init()
sys.exit(app.exec_())

ok so basicaly I have the Mainwindow, then I start a Client() in a thread using QThread, I call myapp.createUserTile(nick, ip) from within the Client() thread and the animation doesn't play, but if I call createUserTile(nick, ip) from MainWindows __init__ the animation plays fine.

Is there anyway I can call myapp.createUserTile(nick, ip) and have the animation play?? I've tried self.anim.moveToThread but thats didn't help

Thanks in advance

Martin
_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to