import gtk
#Definimos las variables globales
entry1 = gtk.Entry()
entry2 = gtk.Entry()
entry3 = gtk.Entry()
entry4 = gtk.Entry()
# CaJaS
def make_box1(homogeneous, spacing, expand, fill, padding):
box = gtk.HBox(homogeneous, spacing)
label = gtk.Label("Usuario:")
label.set_alignment(0, 0)
box.pack_start(label, gtk.FALSE, gtk.FALSE, 10)
label.show()
box.pack_start(entry1, gtk.FALSE, gtk.FALSE, 0)
entry1.show()
return box
def make_box2(homogeneous, spacing, expand, fill, padding):
box = gtk.HBox(homogeneous, spacing)
label = gtk.Label("Nombre del proyecto:")
label.set_alignment(0, 0)
box.pack_start(label, gtk.FALSE, gtk.FALSE, 10)
label.show()
box.pack_start(entry2, gtk.FALSE, gtk.FALSE, 0)
entry2.show()
return box
def make_box3(homogeneous, spacing, expand, fill, padding):
box = gtk.HBox(homogeneous, spacing)
label = gtk.Label("Correo:")
label.set_alignment(0, 0)
box.pack_start(label, gtk.FALSE, gtk.FALSE, 10)
label.show()
box.pack_start(entry3, gtk.FALSE, gtk.FALSE, 0)
entry3.show()
return box
def make_box4(homogeneous, spacing, expand, fill, padding):
box = gtk.HBox(homogeneous, spacing)
label = gtk.Label("Directorio:")
label.set_alignment(0, 0)
box.pack_start(label, gtk.FALSE, gtk.FALSE, 10)
label.show()
box.pack_start(entry4, gtk.FALSE, gtk.FALSE, 0)
entry4.show()
return box
#Boton Enviar
def make_box7(homogeneous, spacing, expand, fill, padding):
box = gtk.HBox(homogeneous, spacing)
button = gtk.Button(" Enviar ")
button.connect("clicked", enviar)
box.pack_start(button, gtk.FALSE, gtk.FALSE, 100)
button.show()
return box
def enviar(widget):
usuario = entry1.get_text()
nombre = entry2.get_text()
correo = entry3.get_text()
directorio = entry4.get_text()
mensaje = gtk.MessageDialog(buttons=gtk.BUTTONS_OK,message_format="Datos: \n" + "Usuario: "+ entry1.get_text() + "\n Nombre del proyecto: " + entry2.get_text() + "\n Correo: " + entry3.get_text() + "\n Directorio: " + entry4.get_text())
mensaje.run()
mensaje.hide()
class PackBox1:
def delete_event(self, widget, event, data=None):
gtk.main_quit()
return gtk.FALSE
def __init__(self):
self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
self.window.connect("delete_event", self.delete_event)
self.window.set_border_width(10)
box1 = gtk.VBox(gtk.FALSE, 0)
box2 = make_box1(gtk.TRUE, 0, gtk.TRUE, gtk.TRUE, 10)
box1.pack_start(box2, gtk.FALSE, gtk.FALSE, 10)
box2.show()
box2 = make_box2(gtk.TRUE, 0, gtk.TRUE, gtk.TRUE, 10)
box1.pack_start(box2, gtk.FALSE, gtk.FALSE, 10)
box2.show()
box2 = make_box3(gtk.TRUE, 0, gtk.TRUE, gtk.TRUE, 10)
box1.pack_start(box2, gtk.FALSE, gtk.FALSE, 10)
box2.show()
box2 = make_box4(gtk.TRUE, 0, gtk.TRUE, gtk.TRUE, 10)
box1.pack_start(box2, gtk.FALSE, gtk.FALSE, 10)
box2.show()
# Caja Boton Enviar Formulario
box2 = make_box7(gtk.FALSE, 0, gtk.FALSE, gtk.FALSE, 0)
box1.pack_start(box2, gtk.FALSE, gtk.FALSE, 0)
box2.show()
#Separadooooooooooooooooooooooooooooooooooooooooooooooooooooooor
separator = gtk.HSeparator()
box1.pack_start(separator, gtk.FALSE, gtk.TRUE, 5)
separator.show()
#boton quit
quitbox = gtk.HBox(gtk.FALSE, 0)
button = gtk.Button("Quit")
button.connect_object("clicked", gtk.mainquit, self.window)
quitbox.pack_start(button, gtk.TRUE, gtk.FALSE, 0)
box1.pack_start(quitbox, gtk.FALSE, gtk.FALSE, 0)
self.window.add(box1)
button.show()
quitbox.show()
box1.show()
self.window.show()
def main():
gtk.main()
return 0
if __name__ =="__main__":
packbox1 = PackBox1()
main()