When you use a function as an argument, as in Button(), you use the name of 
the function, without the open and close parens.  For example:

        button.connect("button_release_event", quit_main)

not

        button.connect("button_release_event", quit_main())

The type of quit_main() is not a function.

On Wednesday 29 May 2002 04:28 pm, you 
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? 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/

-- 
Seth Kurtzberg
MIS Corp.
Office:  (480) 661-1849
Fax: (480) 614-8909
email:  [EMAIL PROTECTED]
pager:  888-605-9296 or email [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/

Reply via email to