You are showing and hiding the window when before gtk.main()
show the window
hide the window
show it again
gets printed before gtk even has a chance to do something about
running your HelloWorld. I don't know how stacked events like this
happen. If we use a timeouts to hide and show it again, I think you
will get the results you were expecting:
import gtk
import gtk.glade
import gobject
def HelloWorld(widget):
print "Hello World!"
gobject.timeout_add(1000, wnd.hide)
gobject.timeout_add(2000, wnd.show)
dic={"on_window1_show": HelloWorld}
Widgets=gtk.glade.XML("onshow.glade", "window1")
Widgets.signal_autoconnect(dic)
wnd = Widgets.get_widget("window1");
wnd.show()
gtk.main()
On Wed, 24 Nov 2004 23:45:23 +0100, Martijn Brouwer
<[EMAIL PROTECTED]> wrote:
>
>
> There was a mistake in the glade file, but still things are not doing
> wha they should do. I have send the glade file as attachment.
>
> Bye,
>
> Martijn
>
> On Wed, 2004-11-24 at 08:52 -0500, Chris Lambacher wrote:
> > post a copy of the glade file that exibits the behaviour you
> > described, but has no content other than window1.
> >
> >
> > On Wed, 24 Nov 2004 08:38:32 +0100, Martijn Brouwer
> > <[EMAIL PROTECTED]> wrote:
> > > Yes, I did.
> > >
> > > Martijn
> > >
> > >
> > >
> > >
> > > On Tue, 2004-11-23 at 17:28 -0500, Chris Lambacher wrote:
> > > > Did you set window1 invisible in your glade file?
> > > >
> > > > > Thanks for your fast answer. Your suggestion works partially. I
> > > > > changed
> > > > > my test program to what is shown below.
> > > > > import gtk
> > > > > import gtk.glade
> > > > > import time
> > > > >
> > > > > def HelloWorld(widget):
> > > > > print "Hello World!"
> > > > >
> > > > > dic={"on_window1_show": HelloWorld}
> > > > > Widgets=gtk.glade.XML("onshow.glade", "window1")
> > > > > Widgets.signal_autoconnect(dic)
> > > > >
> > > > > print "show the window"
> > > > > Widgets.get_widget("window1").show()
> > > > > time.sleep(1)
> > > > > print "hide the window"
> > > > > Widgets.get_widget("window1").hide()
> > > > > time.sleep(1)
> > > > > print "show it again"
> > > > > Widgets.get_widget("window1").show()
> > > > > gtk.main()
> > > > >
> > > > > When I run this program, the output on the console is:
> > > > > show the window
> > > > > hide the window
> > > > > show it again
> > > > > Hello World!
> > > > >
> > > > > The program window only appears after the *second* invocation of
> > > > > show(),
> > > > > just as "Hello World!" is only printed the second time. Apperently,
> > > > > the
> > > > > connection of the signal works. By why is nothing happening on the
> > > > > first
> > > > > invocation?
> > >
> > >
> >
> >
>
>
> _______________________________________________
> pygtk mailing list [EMAIL PROTECTED]
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
>
>
>
>
--
Christopher Lambacher
[EMAIL PROTECTED]
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/