Ver Mensaje Individual
  #7 (permalink)  
Antiguo 05/12/2011, 14:00
Avatar de saulortega
saulortega
 
Fecha de Ingreso: septiembre-2011
Ubicación: Bogotá
Mensajes: 79
Antigüedad: 12 años, 7 meses
Puntos: 0
Respuesta: Que un módulo ejecute otro, y ese ejecute el primero sucesivamente

Gracias. Bueno, entonces, siguiendo lo que dices, hice esto:


Código Python:
Ver original
  1. from Tkinter import *
  2.      
  3. principal = Tk()
  4.      
  5. def ventana1():
  6.     ventana1 = Tk()
  7.     boton1 = Button(ventana1, text="Iniciar ventana 2", width=15, command=ventana2)
  8.     boton1.pack()
  9.     ventana1.mainloop()
  10.  
  11. def ventana2():
  12.     ventana1.destroy()
  13.     ventana2 = Tk()
  14.     boton2 = Button(ventana2, text="Iniciar ventana 3", width=15, command=ventana3)
  15.     boton2.pack()
  16.     ventana2.mainloop()
  17.  
  18. def ventana3():
  19.     ventana2.destroy()
  20.     ventana3 = Tk()
  21.     boton3 = Button(ventana3, text="Iniciar ventana 2", width=15, command=ventana2)
  22.     boton3.pack()
  23.     ventana3.mainloop()
  24.      
  25. ventana1()
  26.      
  27. principal.mainloop()

Pero el comando ".destroy()" no funciona con esas ventanas "hijas". Me aparece esto:

Código:
AttributeError: 'function' object has no attribute 'destroy'
Y sí funciona con la ventana "madre"... ¿Por qué?



Ah, y otra cosa, ¿Cómo oculto la ventana principal?