15,867,568 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Tomas Sanchez Garcia (Top 11 by date)
Tomas Sanchez Garcia
14-Aug-23 4:40am
View
Sorry, already updated. More than anything I was trying to get an idea.
Tomas Sanchez Garcia
10-Aug-23 11:37am
View
Hi, thank you very much for your answer. I have tried testing this way with more statements and within the FOR loop, but it keeps giving me the same error, only one user reads me and not the others.
Regarding security, thanks for the information, this is only for the purpose of learning nothing professional for the public.
def validar(self):
if self.entry_email.get() == "" or self.entry_password.get() == "":
self.dialogo = tk.Toplevel()
self.dialogo.title("ERROR")
self.dialogo.geometry("300x50")
self.dialogo.resizable(0,0)
self.wtotal2 = self.dialogo.winfo_screenwidth()
self.htotal2 = self.dialogo.winfo_screenheight()
self.wventana2 = 300
self.hventana2 = 100
self.pwidth2 = round(self.wtotal2/2-self.wventana2/2)
self.pheight2 = round(self.htotal2/2-self.hventana2/2)
self.dialogo.geometry(str(self.wventana2)+"x"+str(self.hventana2)+"+"+str(self.pwidth2)+"+"+str(self.pheight2))
self.etiqueta = tk.Label(self.dialogo, text="Rellena todos los campos.", padx=10, pady=10)
self.etiqueta.pack()
self.image_boton_vale = Image.open("src/boton_vale.png")
self.photo_boton_vale = ImageTk.PhotoImage(self.image_boton_vale)
self.boton_vale = tk.Button(self.dialogo, image=self.photo_boton_vale, command=self.cerrar_dialogo_vale)
self.boton_vale.pack(pady=5)
self.boton_vale.place(x=86, y=50, width=128, height=31)
else:
self.connection2 = connect_to_database()
self.cursor2 = self.connection2.cursor()
# Ejemplo: Ejecutar una consulta para obtener datos
self.cursor2.execute("SELECT nombre,password FROM usuarios")
self.data2 = self.cursor2.fetchall()
for self.fila in self.data2:
self.v_email = self.fila[0]
self.v_password = self.fila[1]
if self.entry_email.get() == self.v_email and self.entry_password.get() == self.v_password:
self.app.root.destroy()
self.ventana_menu = Menus(self)
else:
self.app.root.destroy()
messagebox.showwarning("Advertencia", "Los datos introducidos son incorrectos.")
self.cursor2.close()
self.connection2.close()
Tomas Sanchez Garcia
6-Aug-23 7:32am
View
Hi, thank you very much.
If it has been solved.
I am very sorry for the inconvenience caused, I am trying to exercise and progress.
I'm learning with OOP and that's why I get a bit stuck, I try to make things more organized.
Thank you very much again, sorry for the inconvenience.
Tomas Sanchez Garcia
31-Jul-23 12:30pm
View
Hola, gracias a todos por vuestra ayuda. Ahora funciona y he logrado entender la lógica.
Ahora tengo esto así en la clase de inicio de sesión:
self.label_email = tk.Label(text=self.t_Email)
y antes era así:
self.label_email = tk.Label(self.root, text=self.t_Email)
¿Por qué tuve que eliminar el "self.root"? Me dio un error si lo puse.
¿La función ya detecta que esas etiquetas y entradas van en la ventana raíz?
Tomas Sanchez Garcia
31-Jul-23 5:30am
View
Thank you very much for your answer, but how could I make the validate function part of the login function? Forgive my ignorance but I got a little stuck in this part.
thank you
Tomas Sanchez Garcia
19-Nov-22 14:10pm
View
Hello, I have already managed to solve the error, the new price is already added to the old one, thanks for making me reflect on it.
Tomas Sanchez Garcia
19-Nov-22 11:49am
View
Hi, I've already tried that, so it only shows me the value of the entered item, but it doesn't add it to the previous one.
It shows me the price of the entered item but it does not add the new prices to the previous ones entered.
I can't get the total of the prices entered in the column.
for self.item in self.tree.get_children():
self.total = 0
self.celda = int(self.tree.set(self.item,"col2"))
self.total += self.celda
print(self.total)
Tomas Sanchez Garcia
18-Nov-22 10:42am
View
Before I tried something similar like this, and it gives me an error, now I'm also doing something like this, but I don't know how to fix it, I'm a bit blank
for self.x2 in self.r_codigo:
print (self.x2["nombre"], self.x2["talla"], self.x2["precio"]+"€")
self.tree.insert('', 'end', text=self.x2["nombre"], values=(self.x2["talla"],self.x2["precio"]+" €"))
print(self.x2["fecha"])
for self.item in self.tree.get_children():
self.resultado = 0
self.celda = int(self.tree.set(self.item,"col2"))
self.total = self.resultado + self.celda
print(self.total)
Tomas Sanchez Garcia
18-Nov-22 10:41am
View
Deleted
Before I tried something similar like this, and it gives me an error, now I'm also doing something like this, but I don't know how to fix it, I'm a bit blank
for self.x2 in self.r_codigo:
print (self.x2["nombre"], self.x2["talla"], self.x2["precio"]+"€")
self.tree.insert('', 'end', text=self.x2["nombre"], values=(self.x2["talla"],self.x2["precio"]+" €"))
print(self.x2["fecha"])
for self.item in self.tree.get_children():
self.resultado = 0
self.celda = int(self.tree.set(self.item,"col2"))
self.total = self.resultado + self.celda
print(self.total)
Tomas Sanchez Garcia
25-Jan-22 11:32am
View
Thank you very much for your answer, I just did what you told me.
Thanks for your time. and sorry for the inconvenience caused.
I thought it had something to do with it, in the sense that everything had to go together.
Now I'm understanding things a little more.
Thanks again.
Greetings!
Tomas Sanchez Garcia
23-Jan-22 8:17am
View
I get it,
But how do I use the database connection of the other file?
Or do I have to create a new one?
def login(self):
con1 = self.conexion1
cur = con1.cursor()
sql = "SELECT * FROM trabajador WHERE nombre=%s AND password=%s"
cur.execute(sql,datos)
comprobardatosAcceso=cur.fetchall()
datos = (self.formUsuarioString.get(), self.formPasswordString.get())
if self.formUsuarioString.get() == "" or self.formPasswordString.get() == "":
MessageBox.showinfo("INFORMACION", "Debes rellenar todos los campos.")
else:
self.ventana1.destroy()
self.conexion1.verificar(datos)
that gives me this error:
self.cur = self.con1.cursor()
AttributeError: 'conexiones' object has no attribute 'cursor'
Show More