QWidget casts with PyQt?

Michael Pyle mpyle at legato.com
Fri Feb 20 13:05:36 EST 2004


Just use the reference you get back as a QButtonGroup object.

The following code works fine for me:



from qt import *

app = QApplication([])
box = QToolBox()
grp = QButtonGroup()
box.addItem( grp, 'button group' )
item = box.item( 0 )
print item
print item.isRadioButtonExclusive()



This outputs:
<__main__.qt.QButtonGroup object at 0x00804360>
True


--mike

-----Original Message-----
From: Ewald R. de Wit [mailto:erdewit at d-e-l-e-t-e.zonnet.nl] 
Sent: Friday, February 20, 2004 2:42 AM
To: python-list at python.org
Subject: Re: QWidget casts with PyQt?


Stefan Quandt wrote:
> I want to access widgets from a Qt container widget e.g.
>   item = ToolBox.item( 0 )
> 
> I know that the item is a QButtonGroup.
> The Qt-Library returns a QWidget pointer.
> So what I get is a Python QWidget wrapper object.

This is quite a general problem for which I would like to know a solution
too.

-- 
  --  Ewald

-- 
http://mail.python.org/mailman/listinfo/python-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20040220/1418c4d2/attachment.html>


More information about the Python-list mailing list