Me estoy iniciando en el lenguaje de Python y en la plataforma, quisiera que me ayudaran un poco, ya cambie el tipo de variable (local, global) y me sigue saliendo el mismo error.
No he encontrado el problema. También me sale el error acompañado de esto :
Traceback (most recent call last): File "C:\Python\lib\tkinter\__init__.py", line 1883, in __call__ return self.func(*args) File "C:/Users/danie/Desktop/PythonTriton/Clases/LoginWindow.py", line 5, in clicbotonIniciar print(var.get()) TypeError: get() missing 1 required positional argument: 'self'
from tkinter import *
class LoginWindow():
def clicbotonIniciar(self):
print(var.get())
def __init__(self):
alto = "500"
ancho = "500"
window=Tk()
window.title("Iniciar Sesión")
pan_altura=window.winfo_screenheight()
pan_ancho = window.winfo_screenwidth()
res=round((pan_ancho/2)-(int(ancho)/2))
res1=round((pan_altura/2)-(int(alto)/2))
posicion="+"+str(res)+"+"+str(res1)
anchoAlto=str(ancho)+"x"+str(alto)
window.geometry(anchoAlto+posicion)
window.resizable(False,False)
window.iconbitmap("C:/Users/danie/Desktop/PythonTriton/Imagenes/Logo.ico")
#window.overrideredirect(True)
fuente="Arial Bold"
fuenteBold="Arial Black"
colorwindowFrame = "#%02x%02x%02x" % (51,51,51)
color_rojo = "#%02x%02x%02x" % (255, 51, 51)
windowFrame = Frame(window, width="500", height="500", bg=colorwindowFrame)
windowFrame.pack()
Imagen = PhotoImage(file="C:/Users/danie/Desktop/PythonTriton/Imagenes/LoginPruebaN.png")
Label(windowFrame, text="Iniciar Sesión",fg="white",bg=colorwindowFrame, font=(fuente,18) ).place(x=190,y=0)
Label(windowFrame, image=Imagen,bg=colorwindowFrame).place(x=200,y=25)
Label(windowFrame,text="USUARIO", font=(fuenteBold,18),fg="white",bg=colorwindowFrame).place(x=190,y=150)
Label(windowFrame, text="CONTRASEÑA", font=(fuenteBold, 18), fg="white", bg=colorwindowFrame).place(x=160, y=230)
Label(windowFrame, text="Llave de\nacceso", font=(fuenteBold, 10), fg="white", bg=colorwindowFrame).place(x=137,y=310)
textUser=Entry(windowFrame,font=("Arial",20), width="15")
textUser.place(x=140,y=190)
textPass=Entry(windowFrame, font=("Arial", 20), width="15", show="*")
textPass.place(x=140, y=270)
textRec=Entry(windowFrame,font=(fuente,10), show="*",width="11")
textRec.place(x=230,y=320)
botonIniciar=Button(windowFrame, text="Iniciar", font=(fuenteBold,14), bd="4", bg="#FF5811", fg="white", justify="center", width="12",activebackground="#FF7E00", command= self.clicbotonIniciar)
botonIniciar.config(cursor="hand2", relief="flat", activeforeground="gray")
botonIniciar.place(x=80,y=430)
botonRegistrar = Button(windowFrame, text="Registrarse", font=(fuenteBold, 14), bd="4", bg="#FF5811", fg="white", activebackground="#FF7E00",width="12")
botonRegistrar.config(cursor="hand2", relief="flat", activeforeground="gray")
botonRegistrar.place(x=270, y=430)
botonRecordar=Checkbutton(text="Recordar",bg=colorwindowFrame,font=(fuenteBold,12), activebackground=colorwindowFrame, fg="#808080",activeforeground="#FF5811")
botonRecordar.config(onvalue=1,offvalue=0, variable=var)
botonRecordar.place(x=137,y=350)
botonCancelar=Button(windowFrame, text="X",bg=color_rojo, fg="white", font=(fuenteBold,11), width="2", activebackground="#FF4949", command = window.destroy)
botonCancelar.config(cursor="hand2", relief="flat", activeforeground="white")
botonCancelar.place(x=460,y=10)
botonFAQ = Button(windowFrame, text="?", bg="#FF5811", fg="white", font=(fuenteBold, 11), width="2",activebackground="#FF7E00")
botonFAQ.config(cursor="hand2", relief="flat", activeforeground="gray")
botonFAQ.place(x=10, y=10)
window.mainloop()
var = IntVar
ventanaLogin=LoginWindow()