Tema: Boton Reset
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 05/11/2011, 12:25
Avatar de PyLau
PyLau
 
Fecha de Ingreso: octubre-2011
Mensajes: 10
Antigüedad: 12 años, 6 meses
Puntos: 1
Boton Reset

Hola a todos!

Como dije en el anterior mensaje que postee soy nueva en python y estoy trabajando con gtk2 para hacer una interfaz gráfica, tengo un formulario sencillo con labels, entry y botones y quisiera saber si hay alguna forma de borrar el texto del entry pulsando un botón.
Algo así como un botón de "Reset" que borre todo lo que hay en todos los entry...
Aquí esta el código si lo necesitan, es súper sencillo lo único que necesito es la función del reset.

Gracias!!!

Código:
#!/usr/bin/env python
#-*- coding: UTF-8 -*-

import pygtk
pygtk.require('2.0')
import gtk

class Formulario:
	
	def __init__(self):
		
		
		window = gtk.Window()
		window.connect('destroy', lambda w: gtk.main_quit())
		window.set_size_request(500,400)
		tablec = gtk.Table(12,9,False)
		

		labeli = gtk.Label("\tArchivo de Configuracion:")
		labeli.show()
		tablec.attach(labeli, 0,9,0,1)		

		labelc11 = gtk.Label("Dominio")
		labelc11.show()
		tablec.attach(labelc11, 0,5,1,2)	
		
		entry = gtk.Entry()
		entry.set_text("dominio")		
		entry.show()		
		tablec.attach(entry, 5,9,1,2)	

		labelc21 = gtk.Label("Usuario")
		labelc21.show()
		tablec.attach(labelc21, 0,5,2,3)	
		
		entryc22 = gtk.Entry()
		entryc22.set_text("pylau")
		entryc22.show()		
		tablec.attach(entryc22, 5,9,2,3)	

		labelc31 = gtk.Label("Directorio")
		labelc31.show()
		tablec.attach(labelc31, 0,5,3,4)	
		
		entryc32 = gtk.Entry()
		entryc32.set_text("pylau")
		entryc32.show()		
		tablec.attach(entryc32, 5,9,3,4)
		
		labelc41 = gtk.Label("Directorio")
		labelc41.show()
		tablec.attach(labelc41, 0,5,4,5)	
		
		entryc42 = gtk.Entry()
		entryc42.set_text("/home/laura/proyectos")
		entryc42.show()		
		tablec.attach(entryc42, 5,9,4,5)
		
		labelc51 = gtk.Label("Nombre")
		labelc51.set_justify(gtk.JUSTIFY_CENTER)
		labelc51.show()
		tablec.attach(labelc51, 0,5,5,6)	
		
		entryc52 = gtk.Entry()
		entryc52.set_text("Laura Estefania Parra Rodriguez")
		entryc52.show()		
		tablec.attach(entryc52, 5,9,5,6)				
		
		labelc61 = gtk.Label("Correo")
		labelc61.show()
		tablec.attach(labelc61, 0,5,6,7)	
		
		entryc62 = gtk.Entry()
		entryc62.set_text("[email protected]")
		entryc62.show()		
		tablec.attach(entryc62, 5,9,6,7)

		labelc71 = gtk.Label("Tu llave pública")
		labelc71.show()
		tablec.attach(labelc71, 0,5,7,8)	
		
		entryc72 = gtk.Entry()
		entryc72.set_text("")
		entryc72.show()		
		tablec.attach(entryc72, 5,9,7,8)
		
		labelc81 = gtk.Label("Lugar1")
		labelc81.show()
		tablec.attach(labelc81, 0,5,8,9)	
		
		entryc82 = gtk.Entry()
		entryc82.set_text("/home/laura/proyectos")
		entryc82.show()		
		tablec.attach(entryc82, 5,9,8,9)
		
		labelc91 = gtk.Label("Lugar2")
		labelc91.show()
		tablec.attach(labelc91, 0,5,9,10)	
		
		entryc92 = gtk.Entry()
		entryc92.set_text("/home/laura/proyectos")
		entryc92.show()		
		tablec.attach(entryc92, 5,9,9,10)

		labelc101 = gtk.Label("Lugar3")
		labelc101.show()
		tablec.attach(labelc101, 0,5,10,11)	
		
		entryc102 = gtk.Entry()
		entryc102.set_text("/home/laura/proyectos")
		entryc102.show()		
		tablec.attach(entryc102, 5,9,10,11)


		buttonc1 = gtk.Button("Reset")
		buttonc1.show()
		tablec.attach(buttonc1, 1,3,11,12)
		
		buttonc2 = gtk.Button("Aplicar")
		buttonc2.show()
		tablec.attach(buttonc2, 5,7,11,12)		

		tablec.show()
		
		window.add(tablec)
		window.show_all()
		
		
def main():
	gtk.main()
	return

if __name__ == "__main__":
    Formulario = Formulario()
    main()