[PyKDE] QTimer.singleShot()

Jonathan Gardner jgardn at alumni.washington.edu
Sun Feb 24 14:49:57 GMT 2002


On Friday 22 February 2002 11:16 pm, Ruth Wright wrote:
> Can anybody help me figure out how to use the singleShot method of a
> QTimer?
> In one of the methods for my class, I try to use singleShot, but always
> get errors:
> I've tried the following:
>
> class MyClass(QFrame):
>     .....
>     def someFunction(self):
>         QTimer.singleShot(2,self,self.dummy);  #---1
>         QTimer.singleShot(2,self,SLOT("dummy()"));  #---2
>         QTimer.singleShot(2,self,SLOT("self.dummy")) #---3
>         QTimer.singleShot(2,self,SLOT("self.dummy()")) #---4
>     def dummy(self):
>         print "hello";
>
>
> 1) produces the error: TypeError: Argument 3 of QTimer.singleShot() has
> an invalid type. The definition is for a char * method, and most other
> places that call for that seem to work fine using this syntax.
>

You'll want to try:
QTimer.singleShot(2, self.dummy)

And do you really want to wait 2 milliseconds?

Jonathan




More information about the PyQt mailing list