Open zhuyihenzheng opened 6 years ago
import gtk
class file_chooser_test(): def init(self): window = gtk.Window() window.connect("delete_event", lambda w,e: gtk.main_quit()) nb = gtk.Notebook() nb.set_tab_pos(gtk.POS_TOP) vbox = gtk.VBox(False, 5) vb = gtk.VBox() hbox = gtk.HBox(True, 3) valign = gtk.Alignment(0.5,0.25, 0, 0) lbl = gtk.Label("Name of student") vb.pack_start(lbl, True, True, 10) text = gtk.Entry() vb.pack_start(text, True, True, 10) valign.add(vb) vbox.pack_start(valign) nb.append_page(vbox) nb.set_tab_label_text(vbox, "Name") hb = gtk.HButtonBox() btn1 = gtk.RadioButton(None,"Degree") hb.add(btn1) btn2 = gtk.RadioButton(btn1,"P.G.") hb.add(btn2) btn3 = gtk.RadioButton(btn1,"Doctorate") hb.add(btn3) nb.append_page(hb) nb.set_tab_label_text(hb, "Qualification") tv = gtk.TextView() nb.append_page(tv) nb.set_tab_label_text(tv, "about") window.add(nb) window.show_all() gtk.main()
def on_button_press_event(self, widget, event=None):
print "event is: ", event
if name == "main": test = file_chooser_test()
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)) checkbox = gtk.CheckButton("Useless checkbox") checkbox.show() label.show() panel = gtk.VBox() panel.pack_start(label) panel.pack_start(checkbox) panel.show_all()
label2 = gtk.Label("ok") label2.show()
frm = gtk.Frame() hb = gtk.HButtonBox() btn1 = gtk.RadioButton(None,"Degree") hb.add(btn1) btn2 = gtk.RadioButton(btn1,"P.G.") hb.add(btn2) btn3 = gtk.RadioButton(btn1,"Doctorate") hb.add(btn3) frm.add(hb) frm.set_label("Qualifications") frm.show_all()
dialog.vbox.pack_start(panel) dialog.vbox.pack_start(frm) dialog.vbox.pack_end(label2) response = dialog.run() dialog.destroy()