Re: Resizing Buttons with PyGTK / Glade



Notebooks map/unmap the pages, pages that have visible=False, or if the
toplevel is invisible, will not be realized at init time, maybe this is causing
grief.

Try making your toplevel visible in Glade or manually realizing your
notebook pages, or possibly calling gtk_container_check_resize() on
the pages when showing them for the first time.

Ummm, then you might move on to check that there isnt a notebook
bug filed for this and file one yourself if there isnt (that part
really helps ;-) )

Cheers,
                 -Tristan


On Sat, Aug 16, 2008 at 1:12 AM, CJ Kucera <pez apocalyptech com> wrote:
> Hello list -
>
> I'm having a strange issue with PyGTK and Glade.  I have a bunch of buttons
> in a table which have a text label, which is blank by default (in the
> .glade file).  My app, as it starts up, populates the text labels.  For
> some reason, given a certain layout, when I'm populating the labels, the
> buttons don't automatically resize themselves to fit the new text I'm
> putting in the buttons, so only the first character or two is displayed in
> the button.
>
> Oddly enough, as soon as I click on *any* one of the buttons on the screen,
> all of them suddenly resize themselves to the appropriate width.
>
> I've been paring down my structure to find the root cause, and there seem
> to be two preconditions to this behavior:
>
>  1) The buttons are inside a scrolledwindow / viewport
>  and
>  2) It must be in a notebook, NOT on the first page, though.
>
> If I remove the scrolledwindow/viewport, then the buttons resize
> automatically just fine, and likewise if I move that content to the front
> page.  With both of those in place, though, I see the behavior that I'm
> seeing.  Unfortunately, in this case I do need to have the scrolledwindow
> in place, and also it needs to be on a non-first-page notebook.
>
> For example, here's a .glade and .py which illustrate the behavior:
>
>  http://apocalyptech.com/linux/pygtk-issue/testing.glade
>  http://apocalyptech.com/linux/pygtk-issue/test.py
>
> And some screenshots.  First, the initial screen, before I click any
> buttons:
>
>  http://apocalyptech.com/linux/pygtk-issue/pygtk-issue-1.png
>
> Then, after I click any of the buttons on that page, I get what's expected:
>
>  http://apocalyptech.com/linux/pygtk-issue/pygtk-issue-2.png
>
> ... so all in all, it's quite mystifying to me.  Any ideas would be
> appreciated.
>
> Some possibly-relevant version information:
>  gtk+ 2.12.5
>  Glade 3.4.5
>  PyGTK 2.10.4
>
> Thanks!
>
> -CJ
>
> --
> WOW: Flemmy            |   "Happiness isn't good enough for me!  I
> pez apocalyptech com   |              demand euphoria!"
> 24.24.2.3171           |                  - Calvin
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
>


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