GladeGen and initializing widgets at startup

David Reed dreedmac at columbus.rr.com
Sun May 7 15:07:51 CEST 2006


On May 7, 2006, at 4:24 AM, Aengys wrote:

> Thank you for your reply!
>
> I finally managed to do what I wanted. Maybe a little side-remark  
> here.
> In the article you have said that all changes to the init-method are
> lost once you regenerate the file. I have tried it, and indeed all my
> changes were lost (which I had backed up before). So I've created a
> method which do the initialization and I call this method from the
> init-method. Maybe it would be a nice extention to include such a
> method by default; a method you can fill with all the code that needs
> to be done when initializing the window.... I'm not yet so familiar
> with the whole process, but I might have a look at it in the future.
> I'll keep you updated on that if it happens.
>

It's been a while since I've looked at it or used it (haven't been  
doing an GUI programming recently). I should have said to put your  
code in the __init__ method after the call to init since the init  
method is regenerated each time.


> Regarding the extension of the show method: how do I do that? And what
> benefit does it have to the solution mentioned above?


You mentioned you were new to Python - you really need to learn more  
(specifically about inheritance) before you can fully understand  
this. The GladeWindow provides a show method but you can write your  
own show method that would get called instead of it. If you want the  
code to just be called once, using the __init__ method is appropriate  
but if your window is repeatedly shown/hidden and you want the code  
executed each time the window is shown.

Dave




More information about the Python-list mailing list