Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Stuck with pyqt: can't get/read button IDs from a qbuttongroup

Reply
Thread Tools

Stuck with pyqt: can't get/read button IDs from a qbuttongroup

 
 
raacampbell@gmail.com
Guest
Posts: n/a
 
      03-18-2007
Hi,

I'm learning Python and QT and have set myself the task of writing a
simple calculator applet. I'm using Qt3 and with the designer have
made a button group which contains 10 buttons to allow the user to
press the digits 0 to 9.

The idea is that the button group is associated with a single slot.
When I click a button the qbuttongroup sends a signal to a slot I've
named getNumber. At the moment I just want this to read buttonGroupid
of the clciked button and write this to the screen (the buttonGroupid
is equal to the value the user wishes to select). So if the user
clicks on, say, button "7" then this digit will be printed to the
listbox. Problem is that I can't work out how to read this ID. I can't
believe it's this hard--I have RTFM, some programing experience, and
have searched google for 3 days. No joy.

The best I've managed so far is this line from the .ui.h file
void calc::getNumber(int id)
{
self.listBox1.insertItem(str(id))
}

which translates to this in the .py:
def getNumber(self,a0):
self.listBox1.insertItem(str(id))


All that does is is print the text "<built-in function id>" to my list
box.

What am I missing?

Thanks!

 
Reply With Quote
 
 
 
 
raacampbell@gmail.com
Guest
Posts: n/a
 
      03-18-2007


> which translates to this in the .py:
> def getNumber(self,a0):
> self.listBox1.insertItem(str(id))
>


As is typically the way with these things, I've just solved it. I
changed the text in the file generated by pyui. It now reads:

def getNumber(self,a0):
self.listBox1.insertItem(a0)


I suppose my question now becomes whether or not editing the .py file
in this manner is good thing to be doing. What references do people
recomend I consult with regard to this sort of thing?

Thanks,
Rob

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PythonCard - My app stuck when button clicked daved170 Python 6 05-14-2009 03:08 PM
Nikon Coolpix Shutter Button Stuck/Jammed p.b. Digital Photography 1 06-29-2005 09:14 PM
Why wireless does not re-enable after switching login ids? joeu2004@hotmail.com Wireless Networking 1 06-28-2005 03:24 AM
after transfer of data from MS-outlook(mail ids) to application,mail ids are consisting of strange characters vamsikrishna_b@coolgoose.com Python 2 06-21-2005 12:41 PM
Integration of an IDS-workstation Eckhardt Newger Wireless Networking 1 01-24-2005 07:46 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57