[pygtk] GtkObject.emit problem

Steve McClure smcclure@racemi.com
09 Oct 2002 22:46:07 -0400

Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

On Wed, 2002-10-09 at 21:06, James Henstridge wrote:
> Steve McClure wrote:
> >I'm sure I'm doing something dumb but I'm trying to simulate a notebook
> >page change if the notebook is already mapped and page X is already
> >displayed.  I'm doing this because I'm loading the contents of the page
> >on the switch signal for that page and you don't get the signal if say
> >the dialog is displaying data and the data source changes.
> >
> >I've tried notebook.emit('switch-page', page, pageNum) and
> >notebook.emit('switch-page', notebook, page, pageNum) but I get this
> >error:
> >
> >  File
> >"/opt/race/share/sw/os/Linux_2.4_i686/python/lib/python2.1/site-packages=
/gtk.py", line 167, in emit
> >    return _gtk.gtk_signal_emitv_by_name(self._o,signal,params)
> >TypeError: argument 1: expected gpointer, GtkObject found
> >
> >Can anyone point out my error please?
> > =20
> >
> You shouldn't be emitting that signal directly.  You should use the=20
> notebook.set_page(page_num) method (which will emit "switch_page" if=20
> appropriate).  The signal takes a pointer argument to a GtkNotebookPage=20
> struct (which shouldn't even be used in C programs these days ...) which=20
> you can't create in Python, which is the cause of the exception.

Interesting.  set_page doesn't do the trick because that page is already
displayed but now there is a new set of data to be displayed.  I gave up
and called the handler directly.

Thanks for the help.

> James.
> --=20
> Email: james@daa.com.au              | Linux.conf.au   http://linux.conf.=
> WWW:   http://www.daa.com.au/~james/ | Jan 22-25   Perth, Western Austral=
> _______________________________________________
> pygtk mailing list   pygtk@daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Steve McClure			430 10th St NW
Racemi				Suite N-210
http://www.racemi.com		Atlanta, GA 30318
smcclure@racemi.com		voice/fax: 404-892-5850

Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org