0

I am trying to create an agenda for my app using tkinter and custom tkinter. the thing is I already used customtkinter.CTkEntry and I didn't have this issue but now It seems the variables are set to None instead of CTkEntry.

What I did before that works is this:

self.entry_agenda = customtkinter.CTkEntry(self, placeholder_text="Búsqueda...",)
        self.entry_agenda.grid(row=3, column=1, columnspan=2, padx=(20, 0), pady=(20, 20), sticky="ew")

        self.busqueda_agenda = customtkinter.CTkButton(master=self, text="Buscar", fg_color="LightSteelBlue2",
                                                       hover_color="LightSteelBlue3", text_color=("Black"),command= lambda : self.busquedaInformadaAgenda(self.entry_agenda.get()))
        self.busqueda_agenda.grid(row=3, column=3, padx=(20, 20), pady=(20, 20), sticky="e")

And what I am trying to do is this:

self.entry_nombre = customtkinter.CTkEntry(master=self, placeholder_text="Nombre...", height=30 ).grid(row=0, column=1, columnspan=2, padx=(20, 0), pady=(20, 20), sticky="we")
        self.entry_tema = customtkinter.CTkEntry(master=self, placeholder_text="Tema...", width=300, height=30 ).grid(row=1, column=1, columnspan=2, padx=(20, 0), pady=(20, 20), sticky="we")
        self.entry_contacto = customtkinter.CTkEntry(master=self, placeholder_text="Contacto...", width=300, height=30 ).grid(row=2, column=1, columnspan=2, padx=(20, 0), pady=(20, 20), sticky="we")
        self.entry_tlfn = customtkinter.CTkEntry(master=self, placeholder_text="Tlfn...", width=300, height=30 ).grid(row=3, column=1, columnspan=1, padx=(20, 0), pady=(20, 20), sticky="w")
        self.entry_tlfn2 = customtkinter.CTkEntry(master=self, placeholder_text="Tlfn 2...", width=300, height=30 ).grid(row=4, column=1, columnspan=1, padx=(20, 0), pady=(20, 20), sticky="w")
        self.entry_tlfn3 = customtkinter.CTkEntry(master=self, placeholder_text="Tlfn 3...", width=300, height=30 ).grid(row=5, column=1, columnspan=1, padx=(20, 0), pady=(20, 20), sticky="w")
        self.entry_fax = customtkinter.CTkEntry(master=self, placeholder_text="Fax...", width=300, height=30 ).grid(row=3, column=3, columnspan=1, padx=(0, 0), pady=(20, 20), sticky="w")
        self.entry_email = customtkinter.CTkEntry(master=self, placeholder_text="Email...", width=300, height=30 ).grid(row=4, column=3, columnspan=2, padx=(0, 0), pady=(20, 20), sticky="w")
        self.entry_web = customtkinter.CTkEntry(master=self, placeholder_text="Web...", width=300, height=30 ).grid(row=5, column=3 , columnspan=2, padx=(0, 0), pady=(20, 20), sticky="w")
        self.entry_movil = customtkinter.CTkEntry(master=self, placeholder_text="Movil...", height=30 ).grid(row=6, column=1, columnspan=2, padx=(20, 0), pady=(20, 20), sticky="we")
        self.entry_movil2 = customtkinter.CTkEntry(master=self, placeholder_text="Movil 2...", height=30 ).grid(row=7, column=1, columnspan=2, padx=(20, 0), pady=(20, 20), sticky="we")
        self.entry_movil3 = customtkinter.CTkEntry(master=self, placeholder_text="Movil 3...", height=30 ).grid(row=8, column=1, columnspan=2, padx=(20, 0), pady=(20, 20), sticky="we")
        self.entry_observaciones = customtkinter.CTkTextbox(master=self, border_width=2, ).grid(row=9, column=1, columnspan=3, padx=(20, 60), pady=(20, 20), sticky="we")

        self.alta_agenda = customtkinter.CTkButton(master=self, text="Confirmar", fg_color="LightSteelBlue2",
                                                   hover_color="LightSteelBlue3", text_color=("Black"),
                                                   command=lambda: self.darAlta()).grid(row=10, columnspan=4, sticky='n', pady=(0,20))
    def darAlta(self):
        cur = self.connection.cursor()
        print(self.entry_contacto.get())
        sql = 'INSERT INTO agenda_telefonica VALUES ('+ self.entry_nombre.get()+''+ self.entry_tema.get()+''+ self.entry_contacto.get()+''+ self.entry_tlfn.get()+''+ self.entry_tlfn2.get()+''+ self.entry_tlfn3.get()+''+ self.entry_fax.get()+''+ self.entry_email.get()+''+ self.entry_web.get()+''+ self.entry_movil.get()+''+ self.entry_movil2.get()+''+ self.entry_movil3.get()+''+ self.entry_observaciones.get()+')'
        cur.execute(sql)
        cur.close()

PS: I didn't check if the SQL sentence is correct, right now i am trying to use the entry value which i cannot access.

MakiMH3
  • 1
  • 2

0 Answers0