DILi DILi - 4 months ago 13
Python Question

How to create a pop window using pygtk?

I have created a simple program. Now I am trying to give it a GUI. Since I have coded in python, I am using pygtk. I have made a main window and now I want to add a pop up window, which will become active when the Open button is pressed in the main window.
I have no previous experience with pygtk.

Answer
import gtk

d = gtk.Dialog()
d.add_buttons(gtk.STOCK_YES, 1, gtk.STOCK_NO, 2)

label = gtk.Label('Do you like GTK?')
label.show()
d.vbox.pack_start(label)

answer = d.run()

print answer

gtk dialog example

Comments