Este código esta hecho en un sistema operativo basado en debian.
Código:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import gtk
#------- campo de texto como global------------------
texto = gtk.Entry()
class MyApp():
#--------------------ventana------------------------------------------
def __init__(self):
window = gtk.Window()
window.set_border_width(0)
window.set_title("CREACION DE CARPETA")
window.set_size_request(520, 180)
window.set_resizable(False)
#-------------------------crear carpeta en home------------------
def crear_carpeta(self, data=None):
systema = os.system('mkdir texto')
#--------------------caja de bonotes y campo de texto--------------------
def make_box1(homogeneous, spacing, expand, fill, padding):
caja = gtk.HBox(homogeneous, spacing)
caja.set_border_width(10)
caja = gtk.HBox(homogeneous, spacing)
caja.set_border_width(10)
#--------------------------etiqueta
etiqueta = gtk.Label("Introduzca el Nombre:")
caja.pack_start(etiqueta, gtk.FALSE, gtk.FALSE, 0)
etiqueta.show()
#------------------ campo de texto dentro de la caja------------------
texto.connect("activate", crear_carpeta)# conectando el texto con def crear_carpeta
caja.pack_start(texto, gtk.FALSE, gtk.FALSE, 20)
texto.show()
#----------------boton con funcion para que cree la carpeta en home---------------
boton = gtk.Button(stock=gtk.STOCK_OK)
boton.connect("clicked", crear_carpeta)#conectando el boton con def crear_carpeta
caja.pack_start(boton, gtk.TRUE, gtk.TRUE, 20)
boton.show()
return caja
#---------- empaquetado de las cajas ---------------------------
vbox = gtk.VBox(gtk.FALSE, 0)
box2 = make_box1(gtk.FALSE, 0, gtk.FALSE, gtk.FALSE,0)
vbox.pack_start(box2, gtk.FALSE, gtk.FALSE, 50)
box2.show()
window.add(vbox)
window.show_all()
#----------------------------------VENTANA---------------------------------
if __name__ == "__main__":
app = MyApp()
gtk.main()


Este tema le ha gustado a 2 personas