On Wed, 2002-05-29 at 19:28, John J Breen wrote:
> Hey,
>       New to pygtk and have some questions. In the follwoing code my
> button connections (cancel button) do not work. It will say 2nd argument
> must be callable. Also the dialog made in the second function automatically
> opens (its part of a larger program). I only want the user to see it when
> they press a key combo or hit a menu item. How do I make it only show up then?

Some options:
        1. Don't call show() on the dialog when you create, create an   handler
for the 'clicked' event on the quit button then
        call <quit_dialog_name>.show()

        2. Use quit_dialog as the handler for the 'clicked' event on the
        quit button.

Either way get rid of the window.hide() at the end of quit_dialog and if
you use option #1 above you'll get rid of the window.show() too.

> Can anyone suggest pygtk resources for someone new to it? I already have
> been viewing the Tutorial by John Finlay.
> 
> Thanks
> John Breen
> 
> def quit_main():
>     gtk.main_quit()
> 
> def quit_dialog():
>     window = gtk.Dialog()
>     button = gtk.Button(stock='gtk-ok')
>     window.action_area.pack_start(button, gtk.TRUE, gtk.TRUE, 10)
>     button.show()
> 
>     button = gtk.Button(stock='gtk-cancel')
>     button.connect("button_release_event", quit_main())
>     button.show()
> 
>     window.action_area.pack_end(button, gtk.TRUE, gtk.TRUE, 10)
>     label = gtk.Label('Are you sure you want to quit?')
>     window.vbox.pack_start(label, gtk.TRUE, gtk.TRUE, 0)
>     label.show()
>     window.show()
>     window.hide()
> 
> _______________________________________________
> pygtk mailing list   [EMAIL PROTECTED]
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
-- 
Steve McClure                   430 10th St NW
Racemi                          Suite N-210
http://www.racemi.com           Atlanta, GA 30318
[EMAIL PROTECTED]             voice/fax: 404-892-5850

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to