>>>>> "Michel" == Michel Thadeu Sabchuk <[EMAIL PROTECTED]> writes:
Michel> Hi guys! I'm learning gtk and pygtk (I started with
Michel> pygtk) and I want to know about a thing... I made a window
Michel> and I want, when I press a button, my program create a
Michel> popup window with a alert... I made it but I connect the
Michel> gtk.mainquit signal to the popup and all the windows are
Michel> killed! How to close only the popup window?
Don't connect mainquit to the popup window. It does what it says --
quits the main program. Instead, you want to do something like
import gtk
window = gtk.Window()
window.show()
window.connect("destroy", gtk.mainquit)
vbox = gtk.VBox(spacing=3)
window.add(vbox)
vbox.show()
dialog = gtk.MessageDialog(
parent = None,
flags = gtk.DIALOG_DESTROY_WITH_PARENT,
type = gtk.MESSAGE_INFO,
buttons = gtk.BUTTONS_OK,
message_format = "Your message here")
dialog.set_title('You clicked me!')
dialog.connect('response', lambda dialog, response: dialog.destroy())
# show the message dialog when they click
button = gtk.Button("Click me")
button.show()
button.connect("clicked", lambda *args: dialog.show())
vbox.pack_start(button, expand=gtk.FALSE, fill=gtk.FALSE)
# quit the main dialog when they click
button = gtk.Button("Quit")
button.show()
button.connect("clicked", gtk.mainquit)
vbox.pack_start(button, expand=gtk.FALSE, fill=gtk.FALSE)
gtk.mainloop()
John Hunter
_______________________________________________
pygtk mailing list [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/