Ver Mensaje Individual
  #1 (permalink)  
Antiguo 01/10/2014, 15:26
Adolfo71
 
Fecha de Ingreso: septiembre-2014
Mensajes: 4
Antigüedad: 9 años, 7 meses
Puntos: 0
Error con self

Buenas tardes compañeros.
Disculpen mis dudas, aún soy nuevo en python.

Tengo este código y me marca error, tengo 2 ventanas, al abrir una cierro la anterior:

Código Python:
Ver original
  1. from tkinter import *
  2.  
  3. class PrincipalPantalla:
  4.     def invcaptura(self):
  5.         self.destroy()
  6.         ventInvCaptura=Tk()
  7.         ventInvCaptura.geometry("500x300+0+0")
  8.         ventInvCaptura.mainloop()
  9.    
  10.     def invprincipal(self):
  11.         self = Tk()
  12.         self.geometry("1024x768+0+0")
  13.  
  14.         barramenu=Menu(self) # Crea barra menus
  15.         mnuInventarios=Menu(barramenu)
  16.         mnuInventarios.add_command(label="Captura",
  17. command=PrincipalPantalla.invcaptura(self))
  18.        
  19.         barramenu.add_cascade(label="Inventarios",menu=mnuInventarios)
  20.        
  21.         self.config(menu=barramenu)
  22.         self.mainloop()
  23.        
  24. a=PrincipalPantalla()
  25. a.invprincipal()


El problema es que me marca este error:

Código:
  File "C:\Python34\lib\tkinter\__init__.py", line 2719, in add_command
    self.add('command', cnf or kw)
  File "C:\Python34\lib\tkinter\__init__.py", line 2710, in add
    self._options(cnf, kw))
_tkinter.TclError: invalid command name ".54520296.51598056"

Última edición por razpeitia; 01/10/2014 a las 21:09