Le 04/08/11 17:24, Di Zou a écrit :
I have a bunch of buttons in a button group. 

Here is my code:

    def Function():
        addAppButtonGroup = QButtonGroup()
        addAppButtonGroup.addButton(addCustomAppButton)
        addAppButtonGroup.addButton(addAppleStoreAppButton)
        addAppButtonGroup.addButton(addWebLinkButton)
        
        addAppButtonGroup.setId(addCustomAppButton, 0)
        addAppButtonGroup.setId(addAppleStoreAppButton, 1)
        addAppButtonGroup.setId(addWebLinkButton, 2)

        self.connect(addAppButtonGroup, SIGNAL("buttonClicked(int)"), self.AddApplication)

        """
        Code that makes the buttons show up on screen
        """
        
    def AddApplication(id):
        print "hi"
        print id

The buttons show up. However when I click a button, nothing is printed on screen. How do I get the buttons connected to the AddApplication function?

Thanks.
_______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Hi,

try:

    def AddApplication(self, id):
        print "hi", id

Remarks:

1  Buttons in QButtonGroup are already identified in order where are added in group with negative value beginning at -2
2   Don't capitalise your functions, see http://www.python.org/dev/peps/pep-0008/
           
Regards
--
Vincent V.V.
Oqapy . Qarte+7 . PaQager


_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to