Shrikanth Kalluraya
Shrikanth Kalluraya

Reputation: 1119

Opening a pop with custom UI in python gtk

I am new to Python GTK programming. In my UI i have a button. On click of that i have to open a popup which has a three button and some label. I have to pass some variables from main window to popup window. on click of buttons on the popup window I have to update this variable. Then once i close this popup window I need the updated value of the variables in main window. 1. Can I do this in Python GTK. 2. If yes how will i go about achieving it. 3. Can I use glade file for creating a glade file.

Upvotes: 3

Views: 1970

Answers (1)

Louis
Louis

Reputation: 2890

You probably need dialog boxes.

From pygtk :

 import gtk

 label = gtk.Label("Nice label")
 dialog = gtk.Dialog("My dialog",
                    None,
                    gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
                    (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
                     gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
 dialog.vbox.pack_start(label)
 label.show()
 checkbox = gtk.CheckButton("Useless checkbox")
 dialog.action_area.pack_end(checkbox)
 checkbox.show()
 response = dialog.run()
 dialog.destroy()

Upvotes: 6

Related Questions