[Glade-users] Glade dialogs



On Wed, 2004-01-14 at 05:34, Greg Hamilton wrote:
I'm finding Glade dialogs a little confusing. I want a modal dialog box 
which appears centred over my app window. I can do this by creating the 
dialog in my code but I've designed a couple of more complex dialogs in 
Glade and I can work out how to get the same behaviour for these 
dialogs. The problem seems to be that my Glade dialogs don't have a 
parent window so they pop up in all sorts of funny places.

To display my Glade dialog (using Python) I do this:

      tree = gtk.glade.XML(GLADEFILE, "config_dialog")
      dialog = tree.get_widget("config_dialog")
      dialog.run()

Calling 'dialog.get_parent()' returns Python's 'None', essentially 
null, so I tried  'dialog.set_parent(app_window)' which fails with the 
following output:

(view-editor.py:1749): Gtk-CRITICAL **: file gtkwidget.c: line 3818 
(gtk_widget_set_parent): assertion `!GTK_WIDGET_TOPLEVEL (widget)' 
failed

The nearest I can get to what I want is by doing this 
'dialog.set_transient_for(app_window)', but the behaviour is slightly 
different to my regular dialogs.

set_transient_for() is the correct thing to use for dialogs. It should
make sure they stay above the parent window.

What is different about the behavior? Is the positioning wrong?

Damon






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]