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


Groups > comp.lang.python > #4921

Re: PyGTK notebook: get current page

Path csiph.com!x330-a1.tempe.blueboxinc.net!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <alex.kapps@web.de>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'handler': 0.05; 'event,': 0.07; 'python': 0.07; '"current': 0.09; 'pages.': 0.09; 'subject:current': 0.09; 'utf-8': 0.09; 'this:': 0.11; 'def': 0.13; 'wrote:': 0.14; '-*-': 0.16; 'argument)': 0.16; 'coded': 0.16; 'coding:': 0.16; 'docs,': 0.16; 'message-id:@web.de': 0.16; 'notebook,': 0.16; 'subject:PyGTK': 0.16; 'template': 0.20; '(or': 0.22; 'header:In-Reply-To:1': 0.22; 'previously': 0.22; 'pages,': 0.25; 'skip:# 10': 0.25; 'changing': 0.29; 'class': 0.29; 'named': 0.30; 'from:addr:web.de': 0.31; 'subject:page': 0.31; 'import': 0.32; 'page.': 0.32; 'to:addr:python-list': 0.32; '...': 0.32; "i've": 0.33; 'page': 0.33; 'print': 0.35; 'open': 0.35; 'header :User-Agent:1': 0.35; 'event': 0.37; 'page:': 0.37; 'should': 0.37; 'but': 0.38; 'code:': 0.38; 'current': 0.38; 'signal': 0.39; 'skip:s 30': 0.39; 'to:addr:python.org': 0.39; 'could': 0.39; 'received:de': 0.39; "it's": 0.40; 'simple': 0.60; 'received:172.20': 0.73; 'received:217.72.192.234': 0.84; 'received:fmmailgate03.web.de': 0.84; 'sender:addr:web.de': 0.84
Date Sun, 08 May 2011 00:05:16 +0200
From Alexander Kapps <alex.kapps@web.de>
User-Agent Mozilla/5.0 (X11; U; Linux i686; de-DE; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8
MIME-Version 1.0
To python-list@python.org
Subject Re: PyGTK notebook: get current page
References <4dc55f75$0$38638$4fafbaef@reader1.news.tin.it>
In-Reply-To <4dc55f75$0$38638$4fafbaef@reader1.news.tin.it>
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
Sender alex.kapps@web.de
X-Sender Alex.Kapps@web.de
X-Provags-ID V01U2FsdGVkX19H82rXztl8hPGAONkim/XIr/mBRXgaUtVHEiLg FlVvAiGHgA0oRj9qTDbUoC6yOKDrBCHek9/kE/8mJepttgApFM 0d/fvwKik=
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
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.1296.1304805925.9059.python-list@python.org> (permalink)
Lines 37
NNTP-Posting-Host 82.94.164.166
X-Trace 1304805925 news.xs4all.nl 81483 [::ffff:82.94.164.166]:51272
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:4921

Show key headers only | View raw


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 | NextPrevious in thread | Find similar


Thread

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