R
raacampbell
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!
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!