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?
>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()
>
This function should be taking a "widget" argument.
>
>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())
>
you probably want the "clicked" signal here, and you want to pass the
quit_main function as an argument, rather than the return value of the
funciton (in this case, None).
> 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()
>
>
James.
--
Email: [EMAIL PROTECTED] | Linux.conf.au 2003 Call for Papers out
WWW: http://www.daa.com.au/~james/ | http://conf.linux.org.au/cfp.html
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/