PushButton and ButtonGroups

alanm me at alandmoore.com
Wed Feb 3 20:01:32 CET 2010


I'm trying to write a plasmoid python script that will have a set of checkable 
buttons of which only one can be checked at a time.  Basically like radio 
buttons, but implemented with pushbuttons for appearance purposes.

I can make the Plasma.pushbutton checkable easily enough, but I can't work out 
how to put them in a button group.  In QT, you'd just make a button group and 
add your pushbuttons to it with QButtonGroup.addButton().  Plasma.PushButtons 
don't work with that approach, though, because I get "argument 1 of 
buttongroup.addButton() is the wrong type".  

I also tried buttongroup.addButton(my_plasma_pushbutton.nativeWidget()), but 
go the same result.

Next, I tried putting plasma pushbuttons in a QGroupBox, but this approach 
also failed.

I guess the question is, what's the correct way to do this with 
Plasma.PushButton since Plasma doesn't seem to have any equivalent of a 
QButtonGroup?

Sorry in advance if I missed something obvious.


More information about the Plasma-devel mailing list