how to query/test the state of a qt widget?

raacampbell at gmail.com raacampbell at gmail.com
Sat Jun 23 20:20:55 EDT 2007


Hi,

I'm writing a simple Python/Qt3 application and I am trying to write
some code in which the user presses a button and the program performs
action A or B depending upon the state of a pair of radio buttons. I
would therefore like Python to read the state of the buttons. I was
expecting this to be straightforward but I've not been able to work
out how to do it and searching on Google hasn't helped. Surely there's
a one-liner that will do what I want? It seems like an every-day sort
of problem. I'm after something like:

if self.polPlotRadioButton.enabled==1: print "BLAH"

I've found squish from www.froglogic.com but that seems over the top.
Possibly pythonqt.sourceforge.net has something that will solve my
problem but that wants Qt4 and at the moment I'm making heavy use of
matplotlib widgets and I've not worked out how to get them to
incorporate into a Qt4 app so I'm stuck with Qt3.

Anyone know the answer?

Thanks in advance!




More information about the Python-list mailing list