I have a dialog opening when I press a button in my application and I want it to center above the application's main window, but I can't find a way to do this. I'm using Quickly (Python) and Glade.

In Glade I've tried the following settings:

  • Window Type = Popup
  • Modal = Yes
  • Window Position = Center on Parent

But I simply can't get the behaviour I'm after. When using the "Window Type" option "Top level" the dialog opens in the center of the screen. When I use "Window Type" = "Popup" it opens in the very top left corner, with the window controls unaccessible.

I know this must be a very basic setting but I've just started developing with GTK and Python so I obviously managed to miss this.

Thanks for any advice! :)

1 Answer 1


When choosing the Center on Parent position, you must also let the dialog know which window is the parent ofcourse. This can either be done in Glade, but only if the parent window is inside the same Glade-file. Or by calling this method:

  • How do I reference the main window (MyappWindow.py - MyappWindow()) from my dialog GotoDialog.py? I'm new to Python so excuse my inexperience. I tried "from myapp import MyappWindow" and then "self.set_transient_for(MyappWindow)". I have created everything with Quickly so it is the default set up after running "quickly add dialog goto".
    – Niklas
    Sep 13, 2012 at 14:52
  • Somewhere in your code, you'll call the dialog with something like dialog = GotoDialog(), just pass the main window instance along with it: dialog = GotoDialog(self).
    – Timo
    Sep 13, 2012 at 22:22
  • I tried doing it in every possible way I could think of but what fixed it was setting it from the window that opened the dialog, like this: goto = GotoDialog() and goto.set_transient_for(self)
    – Niklas
    Sep 14, 2012 at 10:21
  • Ah yes, that's possible too. I just like to set it in the dialog itself, so you can call the dialog from any other window, and it will always center on the calling parent.
    – Timo
    Sep 14, 2012 at 10:49
  • That's how I'd like to do it but I couldn't get it to work. If you have the time can you post a code snippet showing the set up within the dialog and it's constructor?
    – Niklas
    Sep 15, 2012 at 12:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .