[PyQt] Re: PyQt
Jon Chambers
jon.chambers3001 at gmail.com
Thu Mar 6 00:29:22 GMT 2008
Thanks for the speedy responses!
I'm now trying to create a non-paintEvent function that calls an update if
necessary. But now when i do
self.connect(self.timer, QtCore.SIGNAL('timeout()'), self.pollJoysticks())
i get an error: Argument 3 (i.e. the pyFunction call) is of invalid type.
but here (
http://www.riverbankcomputing.com/Docs/PyQt4/pyqt4ref.html#signal-and-slot-support)
It says i should be able to use the form
QtCore.QObject.connect(a, QtCore.SIGNAL("QtSig()"), pyFunction)
I know that the timeout signal and my polling function work because they
worked fine before, all i did was rename paintEvent to pollJoysticks and add
a call to the proper paintEvent, and replace
self.connect(self.timer, QtCore.SIGNAL('timeout()'), self, QtCore.SLOT
('update()')
with what i put above.
if i use
self.connect(self.timer, QtCore.SIGNAL('timeout()'), self, QtCore.SLOT
('pollJoysticks()'))
polljoysticks doesn't get called at all. Is there something special i should
put in the pollJoysticks method to make it a Slot?
thanks
jon
On Wed, Mar 5, 2008 at 11:58 PM, Jon Chambers <jon.chambers3001 at gmail.com>
wrote:
> Hi,
> I'm trying to write a program that creates an onscreen keyboard that uses
> an 2-analogue stick joypad for input. I'm having issues becuase the joystick
> needs to be polled regularly. I'm using a QTimer to call a paintEvent
> update() that polls the joystick in the main class (Keyboard). However
> there's some other drawing i want to do when the joystick is polled. However
> the drawing is supposed to be done by a different class with its own
> graphics etc (called Ring), and i found the only way that seemed to work was
> to put the drawing i want to do in the paintEvent of that class and both
> seem to get called. But this seems kinda weird, and for some reason if i
> simply called the drawing to be done by Ring as a method of the Ring object
> in the paintEvent of Keyboard it doesn't work.
> I'm sorry if there's a bit confusing, i'm very new to programming and QT
> and also asking questions on mailing lists.
>
> Basically doing
>
> Class keyboard()
> ...
> self.timer.start(50)
> self.connect(self.timer, QtCore.SIGNAL('timeout()'), self, QtCore.SLOT
> ('update()'))
> ...
> def paintEvent()
> ...poll the joystick
>
> Class Ring()
> ...
> def paintEvent()
> ... do the ring drawing
>
> works, but doing
>
> Class keyboard()
> ...
> self.timer.start(50)
> self.connect(self.timer, QtCore.SIGNAL('timeout()'), self, QtCore.SLOT
> ('update()'))
> ...
> def paintEvent()
> ...poll the joystick
> ...ring.drawstuff()
>
> Class Ring()
> ...
> def drawstuff()
> ... do the ring drawing
>
> Just lands me with a blank window.
> Hope someone can help explain this.
> thanks
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20080306/b322a09c/attachment.html
More information about the PyQt
mailing list