Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #4921
| Date | 2011-05-08 00:05 +0200 |
|---|---|
| From | Alexander Kapps <alex.kapps@web.de> |
| Subject | Re: PyGTK notebook: get current page |
| References | <4dc55f75$0$38638$4fafbaef@reader1.news.tin.it> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1296.1304805925.9059.python-list@python.org> (permalink) |
On 07.05.2011 17:04, Tracubik wrote:
> Hi all!
> I've made a simple PyGTK program.
> It's a window with a notebook, the notebook have 2 pages
> When changing page, i'ld like to get the id of current page.
>
> I've coded it, but i can get only the previously open page, not the
> current one. This is not a big deal if i have only 2 pages, but it could
> be with 3 or more pages.
>
> Here's the code:
>
> #!/usr/bin/env python
> # -*- coding: utf-8 -*-
>
> # template di finestra in pyGTK
>
> import pygtk
> pygtk.require('2.0')
> import gtk
>
> class FinestraGTK:
>
> def pippo(self, widget, event, data=None):
> print "current page: " + str(self.nb.get_current_page() )
According to PyGTK docs, the event handler for the switch_page
signal should look like this:
def pippo(self, notebook, page, page_num, user_data=None):
...
With this method you get the new page number in page_num (or in your
original method with the misleadingly named "data" argument)
HTH
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar
PyGTK notebook: get current page Tracubik <affdfsdfdsfsd@b.com> - 2011-05-07 15:04 +0000 Re: PyGTK notebook: get current page Alexander Kapps <alex.kapps@web.de> - 2011-05-08 00:05 +0200
csiph-web