[pygtk] loading a glade window with user-preferred size
and location
Danny Milosavljevic
danny.milo at gmx.net
Wed Mar 1 06:47:07 WST 2006
Hi,
Am Freitag, den 24.02.2006, 00:25 +1100 schrieb John Pye:
> Hi Steve,
>
> Sorry for the delay getting back to you following your suggestions on
> this. I tried what you suggested and removed the default size
> specificiation in Glade. It still didn't work: the window shows up very
> small (about 200x300 px) then is resized to my stored-preferences size
> during the next refresh.
>
> What did you mean by "Set the size and position after the window is
> realized but before is it mapped?" -- how can I do that?
By setting the window's "visible" to "false" in the glade file, and in
the code calling self.window.show() after
self.window.set_size_request(blah,blah)
cheers,
Danny
> I basically
> just have the following:
>
> > glade = gtk.glade.XML(GLADE_FILE,"browserwin")
> >
> > self.window = glade.get_widget("browserwin")
> >
> > if not self.window:
> > raise RuntimeError("Couldn't load window from glade file")
> >
> > _display = self.window.get_screen().get_display().get_name()
> > _geom=self.prefs.getGeometrySizePosition(_display,"browserwin")
> > if _geom:
> > self.window.resize(_geom[0],_geom[1])
> > self.window.move(_geom[2],_geom[3])
> >
> > self.window.connect("delete_event", self.delete_event)
>
>
> Cheers
> JP
>
> Steve McClure wrote:
>
> >On Fri, 2006-02-10 at 14:49 +1100, John Pye wrote:
> >
> >
> >>Hi all
> >>
> >>The following doesn't seem to work for me unless I switch the
> >>'set_default_size' to 'resize'. Is this because of something I'm doing
> >>with Glade?
> >>
> >>
> >> self.window = glade.get_widget("browserwin")
> >>
> >> _display = self.window.get_screen().get_display().get_name()
> >>
> >> # my own routine for the previously saved window position....
> >> _geom=self.prefs.getGeometrySizePosition(_display,"browserwin")
> >>
> >> if _geom:
> >> self.window.set_default_size(_geom[0],_geom[1])
> >> #self.window.resize(_geom[0],_geom[1])
> >> self.window.move(_geom[2],_geom[3])
> >>
> >>
> >>The problem with this approach is that the window first shows up at the
> >>Glade-specified size, then is resized later to the user-preferenced
> >>default size. So somehow I'm failing to 'set_default_size' before the
> >>window is first drawn.
> >>
> >>Does this mean I can't use Glade to create a user-preference-sized
> >>window? Is there a better way of doing all this?
> >>
> >>
> >
> >Don't set the size in glade?
> >
> >Set the size and position after the window is realized but before is it
> >mapped?
> >
> >
> >
> >>Cheers
> >>JP
> >>
> >>
> >>
> _______________________________________________
> pygtk mailing list pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
>
More information about the pygtk
mailing list