Ver Mensaje Individual
  #1 (permalink)  
Antiguo 09/10/2012, 11:41
ttenay
 
Fecha de Ingreso: julio-2007
Mensajes: 6
Antigüedad: 16 años, 9 meses
Puntos: 0
Pregunta Error con destroy

hola alguien me podria ayudar tengo el siguiente codigo saca fotos en segundos junto con un segundero me saca la foto y el segundero bien el problema esque no se destruye la venta de la camara pero el segundero si, nose que me falta ayuda soy nueva:

Código Python:
Ver original
  1. import cv
  2. import time
  3. from Tkinter import *
  4. from threading import Timer
  5.  
  6. ventana = Tk()
  7. ventana.title("Botones")
  8. ventana.geometry("350x50+500+150")
  9.  
  10. def foto_seg():
  11.  
  12.  def stream():
  13.    global camara
  14.    global frame
  15.    frame = cv.QueryFrame(camara)
  16.    cv.ShowImage("camara", frame)
  17.    cv.MoveWindow("camara", 600, 320)
  18.    cv.SaveImage("testing.png", frame)
  19.  stream()
  20.  
  21.  def contador(texto):
  22.   def count():
  23.     global counter
  24.     counter += -1
  25.     texto.config(text=str(counter))
  26.     texto.after(1000, count)    
  27.   count()
  28.  
  29.  global istime
  30.  while (istime):
  31.    stream()
  32.    cv.WaitKey(15)
  33.    istime -= 1
  34.  
  35.  seg = Tk()
  36.  seg.geometry("350x50+700+350")
  37.  seg.title("Captura")
  38.  Label(seg, text="Tomando foto en  ....",
  39.         fg = "black", font = "Verdana 10 bold").pack()
  40.  texto = Label(seg, fg="red", font = "Verdana 16 bold")
  41.  contador(texto)
  42.  texto.pack()
  43.  
  44.  for x in range(0, 60):
  45.    seg.update()
  46.    time.sleep(0.07)
  47.  
  48.  seg.destroy() 
  49.  time.sleep(5)
  50.  
  51. boton = Button(ventana, text="Iniciar", width=10, command=foto_seg).pack()
  52. boton = Button(ventana, text="Exit", width=10, command=sys.exit).pack()
  53.  
  54. istime = 10
  55. frame = None
  56. counter = 5
  57. camera = None
  58. camara = cv.CaptureFromCAM(0)
  59. cv.SetCaptureProperty(camara, cv.CV_CAP_PROP_FRAME_HEIGHT, 480/2)
  60. cv.SetCaptureProperty(camara, cv.CV_CAP_PROP_FRAME_WIDTH, 640/2)
  61. cv.NamedWindow("camara", cv.CV_WINDOW_AUTOSIZE)
  62.  
  63.  
  64. cv.DestroyAllWindows("camara")
  65. cv.ShowImage("camara", frame)
  66. ventana.mainloop()


Me sale este error nose como solucionarlo

invalid command name "40594240callit"
while executing
"40594240callit"
("after" script)


Gracias