[pyar] Consulta Tkinter
Lucas
rollbak en gmail.com
Mar Abr 15 12:11:12 ART 2014
2014-04-15 11:26 GMT-03:00 patricio tula <tula.patricio en gmail.com>:
> Hola,
> Estoy diseñando un programa para controlar prestamos de herramientas para
> el laboratorio abierto de fiuba y tengo un problema con el bloque de
> código de la interfaz gráfica agregado abajo.
> Concretamente, el problema es que las entradas de texto no se guardan y
> cuando quiero utilizar la info en otro ventana no puedo. Alguien tiene idea
> porque está pasando esto? como podría solucionarlo?
> Desde ya muchas gracias,
> Patricio
>
> PD: Aviso, soy Newbie en python todavía.
>
>
> 8 def PrestamosHerramientas():
> 9 str1=StringVar()
> 10 str2=StringVar()
> 11 Prestamos = Tk()
> 12 Prestamos.title("LABI-Sistema de control de prestamos-Prestamos")
> 13 #Nombre y apellido
> 14 L1=Label(Prestamos,text="Nombre y Apellido").grid(row=0,column=0)
> 15 E1=Entry(Prestamos,textvariable=str1, bd=5).grid(row=0,column=1)
> 16 #DNI
> 17 L2=Label(Prestamos, text="DNI").grid(row=1,column=0)
> 18 E2=Entry(Prestamos, textvariable=str2,bd=5).grid(row=1, column=1)
> 19 print str1
> 20 print str2.get()
> 21 print str2
> 22 print str1.get()
> 23 def Prestar():#TODO Arreglar, esto no anda. str1 y str2 estan
> vacios
> 24 text1=str1.get()
> 25 text2=str2.get()
> 26 print str1
> 27 print str2
> 28 print text1
> 29 print text2
> 30 Prestamos.destroy()
> 31 Prestado = Tk()
> 32 Prestado.title("Prestado")
> 33 PrestarNyALabel = Label(Prestado, text=text1).pack()
> 34 PrestarDNILabel = Label(Prestado, text=text2).pack()
> 35 Prestado.mainloop()
> 36
> 37
> PrestarBoton=Button(Prestamos,text="PRESTAR",command=Prestar).grid(row=2,column=2)
> 38
> 39
> 40 Prestamos.mainloop()
>
>
> _______________________________________________
> pyar mailing list pyar en python.org.ar
> http://listas.python.org.ar/listinfo/pyar
>
> PyAr - Python Argentina - Sitio web: http://www.python.org.ar/
>
> La lista de PyAr esta Hosteada en USLA - Usuarios de Software Libre de
> Argentina - http://www.usla.org.ar
>
Patricio,
Tu problema es que estas creando el "top-level widget" despues de crear los
widgets de StringVar, entonces no se bindean a ningun padre.
Pone la linea 11 al principio de tu metodo y todo deberia andar.
Saludos,
--
Lucas
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://listas.python.org.ar/pipermail/pyar/attachments/20140415/acc8ff63/attachment.html>
More information about the pyar
mailing list