473,385 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

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!

Jun 24 '07 #1
2 1724
ra*********@gmail.com schrieb:
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?
RTFM. The Qt-docs are extensive. And the QRadioButton-docs are pretty
straight forward:

http://doc.trolltech.com/3.3/qradiob...l#checked-prop

So your code above should be

if self.polPlotRadioButton.isChecked(): print "blah"

Diez
Jun 24 '07 #2
RTFM. The Qt-docs are extensive. And the QRadioButton-docs are pretty
straight forward:

http://doc.trolltech.com/3.3/qradiob...l#checked-prop

So your code above should be

if self.polPlotRadioButton.isChecked(): print "blah"
Thanks, that does indeed work.
Also, sorry, I have been trying to RTFM but I'm new to both Python and
Qt so not always sure what I'm looking for.

Jun 24 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Diamondback | last post by:
I have two tables, WIDGETS and VERSIONS. The WIDGETS table has descriptive information about the widgets while the VERSIONS table contains IDs relating to different iterations of those widgets...
7
by: rong.guo | last post by:
Hello, Please see the original data below. I would like to extract the account with the earliest opening date only, and leave all the accounts opened after that out. Could anybody help me with...
3
by: Myron | last post by:
I'm trying to create a query that will tell me which requests took longer than 10 days to move one from particular state to another state. The query I've created returns the correct requests, but...
9
by: DS | last post by:
I need to run a Query that returns Products wirh a Sale Date Older Than 20 Days and doesn't have a Sale Date of earlier than 20 Days, Any Suggestions. I hope this clearer than my last post....
7
by: John | last post by:
I currently have a form and subform based on two tables; tblGoodsIn and tblGoodsInDetail. The fields in the underlying tables do not contain any price information. only foreign key links to...
2
by: Jody | last post by:
Hi I've been working on a database which basically incorporates 3 tables to describe say a widget which is either sold or leased. I have the Widget table which stores the information related...
5
by: TonyJH | last post by:
Hi. I'm new to this database world. Just started Access training a few months ago and have a somewhat complicated database already built. In a nutshell, I have a select query that uses a parameter...
8
by: rahulnag22 | last post by:
I have created a button widget with a button click binding. The button initially has a state=disabled. I can see the greyed out version of the button in the GUI. But If I click on the button it...
2
by: Superfreak31 | last post by:
Hello All, I need help with a SQL Query. I have a table with a StateId and PartNumber. I'll be joining some tables to get the state name from the StateId and Part Description from the Part...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.