[PyQt] Type casting

Arnold Krille arnold at arnoldarts.de
Tue Mar 31 16:12:40 BST 2009


On Tuesday 31 March 2009 16:49:00 Rendezvous wrote:
> How does one type cast in PyQt4? For example, a QObject to a QAction?

For what do you need type-casting in python? To check whether the argument is 
of the right type? Take a look at isinstance().
Otherwise just call the QAction-functions you want, if it is a QAction all is 
fine, if it isn't, you get an error. Either this is a real error because the 
object should always be a QAction, or you have to do input-checking with 
isinstance() before doing the real work in your function...

Have fun,

Arnold
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090331/1a0481d2/attachment.bin


More information about the PyQt mailing list