Le jeu 06/03/2003 à 13:55, Christian Reis a écrit :
> On Wed, Mar 05, 2003 at 11:57:24PM +0100, Martin Preishuber wrote:
> > > > 2.) I create some windows with glade (pygtk2 1.99.15), to use it I do
> > > > something like:
> > > > 
> > > >         xml = gtk.glade.XML(gladefile)
> > > > 
> > > > this works fine, but it immidiately shows the window ... is there any
> > > > way to load it invisible and set it to visible manually later ? I need
> > > > to fill some parts of the window before it is visible.
> > > 
> > > Go into glade, mark the window, go the Common tab, uncheck Visible.
> > 
> > thanks again ... how comes, that I feel somehow stupid now ? :|
> 
> You shouldn't. This is a very common problem when using liglade to build
> a complex application -- the parse of the file has the side-effect of
> rendering the window when it's marked as visible.
> 
> I've discussed this before, and I'm not sure there is a good solution to
> the problem. On one hand, you could ignore the visible attribute for
> top-level windows, but that would be violating the 1-1 correspondence
> between gladefile and libglade tree which is expected. On the other
> hand, you could have Glade make GtkWindows not visible my default; but
> then you have a consistency issue between windows and other widgets.
> 
> I don't see solutions (beyond stuff like 
> 
>     GladeXML("foo.glade", invisible_windows=1)
> 
> which I don't like very much). But maybe somebody else does.
> 


Hi,
Here is my approach to use glade for a complex application. I suppose an
application with two windows (window1 and an about widget).

def on_about_activate(obj):
        about = XML("foo.glade", "about1").get_widget("about1")
        about.show()

def start_foo():
        global wTree
        dic = {"gtk_main_quit": mainquit,
               "on_button1_clicked":on_about_activate}

        gnome.init("foo.glade","2.0")
        wTree = XML("foo.glade", "window1")
        wTree.signal_autoconnect(dic)

        """At this level only window1 appear and when you button1 is
        clicked the about1 widget appear too.
        You haven't to specify anything for a GtkWidget like not
        visible property. 
        """

if __name__ == "__main__":
    start_foo()
    mainloop()

Perhaps is not a correct approach but it works very well for.

_______
Omar Mekkaoui
Thema, University of Cergy-Pontoise
France





_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to