PyGtk and multiple windows

Nemesis Nemesis at nowhere.invalid.it
Sat Jan 25 16:36:16 CET 2003


Hi all,
  I'm learning Python writing a little application (a newsreader).
The interface is designed with Glade, and it is imported in the python
app with the function GladeXML from LibGlade.
The interface has two windows, one of them (I'll call it window2) is in
the hide status (I set the proper switch with Glade), so when it has
to be visible I call a function that does window2.show(). I've linked
the method on_window2_destroy() to the signal destroy related to the
widget window2, this method simply hide window2 and returns 1 (this
should prevent destruction of window2).
But there is a problem, when I show the first time window2 it works
fine, but if I close it and try to reopen I get this error:

Gtk-CRITICAL **: file gtkstyle.c: line 513 (gtk_style_attach): assertion
`style != NULL' failed.

Gtk-CRITICAL **: file gtkstyle.c: line 1134 (gtk_style_set_background):
assertion `style != NULL' failed.

Gtk-CRITICAL **: file gtkstyle.c: line 3613 (gtk_paint_flat_box):
assertion `style != NULL' failed.

And I get a little black window without any widget in it.

Where is the problem?


I've tested the application with the software that can be found
in Debian Woody:

Python  2.1.3
Gtk     1.2.10
PyGtk   0.6.9
PyGlade 0.6.9
Glade   0.6.4



This is the code:

# This is the callback that activates window2

def on_lista_gruppi1_activate (obj):
    "Mostra la finestra con la lista dei gruppi."
    print "lista gruppi1 activate"
    window2.show()


# This is the callback linked to the destroy signal

def on_window2_destroy(obj):
    "Metodo richiamato alla distruzione della window2"
    print "win2 destroy"
    window2.hide()
    return 1

# This is the function that loads the interface 
interface = GladeXML ("newsx.glade")

# Connecting the signals
dic ={"on_lista_gruppi1_activate":on_lista_gruppi1_activate,
      "on_window1_destroy":mainquit,
      "on_window2_show":on_window2_show,
      "on_button1_clicked":on_button1_clicked,
      "on_button2_clicked":on_button2_clicked,
      "on_button5_clicked":on_button5_clicked,
      "on_clist2_select_row":on_clist2_select_row,
      "on_clist3_select_row":on_clist3_select_row,
      "on_clist1_select_row":on_clist1_select_row,
      "on_ctree1_select_row":on_ctree1_select_row,
      "on_window2_destroy":on_window2_destroy}

interface.signal_autoconnect(dic)


The complete program can be found at :
http://digilander.libero.it/nemesis2001/codice/newsx-0.0.1.tgz

P.S. Please forgive my poor english ;-)
-- 
 |\ |       <-> http://digilander.libero.it/nemesis2001/
 | \|emesis <->      "War, war never change us..."
  




More information about the Python-list mailing list