Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #6210

Re: pyGTK identify a button

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 <claudiu@virtuamagic.com>
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 <claudiu@virtuamagic.com>
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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2059.1306313058.9059.python-list@python.org> (permalink)
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

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

> the two button are connected (when clicked) to infoButton(self, 
> widget, 
> data=None)

From documentation:
handler_id = 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=None):
        # discover wich button was pressed
        ...
        # say hello to the button
        if data == 1:
                print "Hi, button1!"
        else:
                print "Hi, button2!"

-- 
  Claudiu Nicolaie CISMARU
  GNU GPG Key: http://claudiu.targujiu.net/key.gpg
  T: +40 755 135455
  E: claudiu@virtuamagic.com, claudiu.cismaru@gmail.com

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

pyGTK identify a button Tracubik <affdfsdfdsfsd@b.com> - 2011-05-25 10:18 +0200
  Re: pyGTK identify a button Claudiu Nicolaie CISMARU <claudiu@virtuamagic.com> - 2011-05-25 11:44 +0300
    Re: pyGTK identify a button Tracubik <affdfsdfdsfsd@b.com> - 2011-05-25 10:51 +0200
      Re: pyGTK identify a button Claudiu Nicolaie CISMARU <claudiu@virtuamagic.com> - 2011-05-25 12:19 +0300
  Re: pyGTK identify a button Chris Angelico <rosuav@gmail.com> - 2011-05-25 18:58 +1000
  Re: pyGTK identify a button Cousin Stanley <cousinstanley@gmail.com> - 2011-05-25 16:22 +0000
  Re: pyGTK identify a button Alister Ware <alister.ware@ntlworld.com> - 2011-05-26 17:50 +0000

csiph-web