Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!news2.euro.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.034 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'else:': 0.03; 'content- type:multipart/signed': 0.09; '(when': 0.16; 'content- type:application/pgp-signature': 0.16; 'filename:fname piece:asc': 0.16; 'filename:fname piece:signature': 0.16; 'filename:fname:signature.asc': 0.16; 'subject:button': 0.16; 'subject:pyGTK': 0.16; 'header:In-Reply-To:1': 0.21; '(this': 0.22; 'skip:b 20': 0.23; 'code': 0.24; 'url:key': 0.30; 'print': 0.31; 'connected': 0.32; 'done': 0.32; 'to:addr:python-list': 0.33; '...': 0.34; 'header:User-Agent:1': 0.35; 'gnu': 0.35; 'skip:o 20': 0.37; 'two': 0.37; 'data': 0.38; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'really': 0.40; 'header:Message-Id:1': 0.62; 'url:net': 0.63; 'discover': 0.67; 'header:Reply-To:1': 0.72; 'reply-to:no real name:2**0': 0.72; 'so:': 0.84 From: Claudiu Nicolaie CISMARU Organization: virtuaMAGIC To: python-list@python.org Subject: Re: pyGTK identify a button Date: Wed, 25 May 2011 11:44:12 +0300 User-Agent: KMail/1.13.7 (Linux/2.6.37.6-0.5-desktop; KDE/4.6.3; i686; ; ) References: <4ddcbb68$0$18241$4fafbaef@reader2.news.tin.it> In-Reply-To: <4ddcbb68$0$18241$4fafbaef@reader2.news.tin.it> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1465458.Rqic7NvL9d"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: claudiu@virtuamagic.com List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 47 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1306313058 news.xs4all.nl 49182 [::ffff:82.94.164.166]:38923 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:6210 --nextPart1465458.Rqic7NvL9d Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable > the two button are connected (when clicked) to infoButton(self,=20 > widget,=20 > data=3DNone) =46rom documentation: handler_id =3D object.connect(name, func, func_data) So: button1.connect(when is pressed, your_function, 1) button2.connect(when is pressed, your_function, 2) (This code is conception, I don't really know how is done in GTK). On the callback: infoButton(self, widget, data=3DNone): # discover wich button was pressed ... # say hello to the button if data =3D=3D 1: print "Hi, button1!" else: print "Hi, button2!" =2D-=20 Claudiu Nicolaie CISMARU GNU GPG Key: http://claudiu.targujiu.net/key.gpg T: +40 755 135455 E: claudiu@virtuamagic.com, claudiu.cismaru@gmail.com --nextPart1465458.Rqic7NvL9d Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.16 (GNU/Linux) iEYEABECAAYFAk3cwV8ACgkQhU2qCxfP7CrYrACdF/uQHvVwtdyEpkpE92iw2wIA dhQAnRA1E8UYS0kcEbM9Zk4Gu0AOOO0f =irEb -----END PGP SIGNATURE----- --nextPart1465458.Rqic7NvL9d--