[PyQt] How to use QButtonGroup?

Sibylle Koczian Sibylle.Koczian at t-online.de
Sun Nov 25 14:05:39 GMT 2007


I'm reading the documentation about QButtonGroup and QGroupBox and I don't 
quite understand the relationship between them. 

I can create QRadioButtons and put them into a QGroupBox. That makes them 
visible and mutually exclusive. And, of course, I should put a layout between 
the box and the buttons. Right? 

If I put those same buttons into a QButtonGroup, then I can map them to 
integers, and I can connect the buttonClicked(int) signal of the group to a 
method or function that can use the id of the button. Still right?

But there seems to be no connection between the QGroupBox and the 
QButtonGroup. I have to put each of my radio buttons into the box _and_ into 
the buttongroup. Right, or did I overlook something?

Thank you,

Dr. Sibylle Koczian
Fasanenstraße 12
82293 Mittelstetten

More information about the PyQt mailing list