Python - Problema con ttk.Label en POO (python)

 
Vista:
Imágen de perfil de Tomas

Problema con ttk.Label en POO (python)

Publicado por Tomas (7 intervenciones) el 20/01/2022 20:19:15
Hola, buenas a tod@s

Estoy haciendo código POO y tengo algún problema, he buscado en internet y supuestamente lo estoy haciendo bien. Pero me da error y no me ejecuta.

Tengo esto:

Código
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from tkinter import *
from tkinter import ttk
import pymysql
from tkinter import messagebox as MessageBox
from tkinter import scrolledtext as st
 
class Aplicacion:
	def __init__(self):
		self.ventana1 = Tk()
		self.ventana1.title("Login")
		self.ventana1.geometry("400x400")
		self.imagenLogo = PhotoImage(file="logo2.png")
		self.divLogo = Label(self.ventana1, image=self.imagenLogo)
		self.divLogo.place(x=93, y=0)
		self.x_ventana = self.ventana1.winfo_screenwidth() // 2 - 300 // 2
		self.y_ventana = self.ventana1.winfo_screenheight() // 2 - 300 // 2
		self.posicion = str(300) + "x" + str(300) + "+" + str(self.x_ventana) + "+" + str(self.y_ventana)
		self.ventana1.geometry(self.posicion)
		self.ventana1.resizable(0,0)
 
		self.formulario()
 
 
 
		self.ventana1.mainloop()
 
	def formulario(self):
		### Formulario de Entrada ###
        self.label1 = ttk.Label(text="Usuario:").place(x=50, y=110)
 
 
 
Ventana = Aplicacion()

Lo que quiero es insertar un Label de tkinter en la ventana gráfica desde una función.
Pero me da este erro en sublime text:

Código:
1
2
3
4
5
6
7
File "/Users/tomas/Downloads/DonMovil/objetos.py", line 29
    self.label1 = ttk.Label(text="Usuario:").place(x=50, y=110)
TabError: inconsistent use of tabs and spaces in indentation
[Finished in 47ms with exit code 1]
[cmd: ['python3', '-u', '/Users/tomas/Downloads/DonMovil/objetos.py']]
[dir: /Users/tomas/Downloads/DonMovil]
[path: /Library/Frameworks/Python.framework/Versions/3.10/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin]


Cualquier información adicional lo agradeceria.
Saludos!
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder