[pygtk] loading a glade window with user-preferred size
and location
John Pye
john.pye at student.unsw.edu.au
Thu Feb 23 21:25:47 WST 2006
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? 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
>>
>>
>>
More information about the pygtk
mailing list