<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
Le 04/08/11 17:24, Di Zou a écrit :
<blockquote
cite="mid:1312471462.33613.YahooMailNeo@web110808.mail.gq1.yahoo.com"
type="cite">
<div style="color: rgb(0, 0, 0); background-color: rgb(255, 255,
255); font-family: arial,helvetica,sans-serif; font-size: 12pt;">
<div style="font-family: arial,helvetica,sans-serif; font-size:
12pt;">I have a bunch of buttons in a button group. </div>
<div style="font-family: arial,helvetica,sans-serif; font-size:
12pt;"><br>
</div>
<div style="font-family: arial,helvetica,sans-serif; font-size:
12pt;">Here is my code:</div>
<div style="font-family: arial,helvetica,sans-serif; font-size:
12pt;"><br>
</div>
<div style="font-family: arial,helvetica,sans-serif; font-size:
12pt;"> def Function():</div>
<div>
<div><font class="Apple-style-span" face="arial, helvetica,
sans-serif"> addAppButtonGroup = QButtonGroup()</font></div>
<div><font class="Apple-style-span" face="arial, helvetica,
sans-serif">
addAppButtonGroup.addButton(addCustomAppButton)</font></div>
<div><font class="Apple-style-span" face="arial, helvetica,
sans-serif">
addAppButtonGroup.addButton(addAppleStoreAppButton)</font></div>
<div><font class="Apple-style-span" face="arial, helvetica,
sans-serif">
addAppButtonGroup.addButton(addWebLinkButton)</font></div>
<div><font class="Apple-style-span" face="arial, helvetica,
sans-serif"> </font></div>
<div><font class="Apple-style-span" face="arial, helvetica,
sans-serif">
addAppButtonGroup.setId(addCustomAppButton, 0)</font></div>
<div><font class="Apple-style-span" face="arial, helvetica,
sans-serif">
addAppButtonGroup.setId(addAppleStoreAppButton, 1)</font></div>
<div><font class="Apple-style-span" face="arial, helvetica,
sans-serif">
addAppButtonGroup.setId(addWebLinkButton, 2)</font></div>
<div><font class="Apple-style-span" face="arial, helvetica,
sans-serif"><br>
</font></div>
<div><font class="Apple-style-span" face="arial, helvetica,
sans-serif">
<div> self.connect(addAppButtonGroup,
SIGNAL("buttonClicked(int)"), self.AddApplication)</div>
<div><br>
</div>
<div> """</div>
<div> Code that makes the buttons show up on screen</div>
<div> """</div>
<div> </div>
<div> def AddApplication(id):</div>
<div> print "hi"</div>
<div> print id</div>
<div><br>
</div>
<div>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?</div>
<div><br>
</div>
<div>Thanks.</div>
</font></div>
</div>
</div>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
PyQt mailing list <a class="moz-txt-link-abbreviated" href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a>
<a class="moz-txt-link-freetext" href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a></pre>
</blockquote>
Hi, <br>
<br>
try:<br>
<br>
def AddApplication(self, id):<br>
print "hi", id<br>
<br>
Remarks:<br>
<br>
1 Buttons in <font class="Apple-style-span" face="arial,
helvetica, sans-serif">QButtonGroup are already identified in
order where are added in group with negative value beginning at -2<br>
2 Don't capitalise your functions, see
<a class="moz-txt-link-freetext" href="http://www.python.org/dev/peps/pep-0008/">http://www.python.org/dev/peps/pep-0008/</a><br>
<br>
</font>Regards<br>
<div class="moz-signature">-- <br>
Vincent V.V.<br>
<a href="https://launchpad.net/oqapy">Oqapy</a> . <a
href="https://launchpad.net/qarte+7">Qarte+7</a> . <a
href="https://launchpad.net/paqager">PaQager</a></div>
</body>
</html>