Thanks for the speedy responses!<br>
I'm now trying to create a non-paintEvent function that calls an update if necessary. But now when i do<br>
<br>
self.connect(self.timer, QtCore.SIGNAL('timeout()'), self.pollJoysticks())<br>
<br>
i get an error: Argument 3 (i.e. the pyFunction call) is of invalid
type. but here
(<a href="http://www.riverbankcomputing.com/Docs/PyQt4/pyqt4ref.html#signal-and-slot-support">http://www.riverbankcomputing.com/Docs/PyQt4/pyqt4ref.html#signal-and-slot-support</a>)
It says i should be able to use the form<font size="2"><br style="font-family: arial,sans-serif;">
</font>
<pre class="literal-block"><font size="2"><span style="font-family: arial,sans-serif;">QtCore.QObject.connect(a, QtCore.SIGNAL("QtSig()"), pyFunction)</span></font><br><br></pre>
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 <br>
self.connect(self.timer, QtCore.SIGNAL('timeout()'), self, QtCore.SLOT('update()')<br>
with what i put above.<br>
if i use<br>
self.connect(self.timer, QtCore.SIGNAL('timeout()'), self, QtCore.SLOT('pollJoysticks()'))<br>
polljoysticks doesn't get called at all. Is there something special i should put in the pollJoysticks method to make it a Slot?<br>
thanks<br>
jon<br><br><div class="gmail_quote">On Wed, Mar 5, 2008 at 11:58 PM, Jon Chambers <<a href="mailto:jon.chambers3001@gmail.com">jon.chambers3001@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>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.<br>
I'm sorry if there's a bit confusing, i'm very new to programming and QT and also asking questions on mailing lists.<br><br>Basically doing<br><br>Class keyboard()<br>...<br>self.timer.start(50)<br>self.connect(self.timer, QtCore.SIGNAL('timeout()'), self, QtCore.SLOT('update()'))<br>
...<br>def paintEvent()<br>...poll the joystick<br><br>Class Ring()<br>...<br>def paintEvent()<br>... do the ring drawing<br><br>works, but doing<br><br>
Class keyboard()<br>
...<br>
self.timer.start(50)<br>
self.connect(self.timer, QtCore.SIGNAL('timeout()'), self, QtCore.SLOT('update()'))<br>
...<br>
def paintEvent()<br>
...poll the joystick<br>...ring.drawstuff()<br><br>Class Ring()<br>
...<br>
def drawstuff()<br>
... do the ring drawing<br>
<br>Just lands me with a blank window.<br>Hope someone can help explain this.<br>thanks<br>
</blockquote></div><br>