Python - TypeError: get() missing 1 required positional argument: "self"

 
Vista:
Imágen de perfil de Miguel
Val: 4
Ha disminuido su posición en 20 puestos en Python (en relación al último mes)
Gráfica de Python

TypeError: get() missing 1 required positional argument: "self"

Publicado por Miguel (3 intervenciones) el 14/11/2019 08:37:35
Necesito ayuda con mi código porque al momento de ejecutar me aparece el siguiente error:
TypeError: get() missing 1 required positional argument: 'self'

Ya le intente de diferentes formas pero sigue apareciendo el error

Aquí esta el código es en python:


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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
from tkinter import *
from tkinter import messagebox
import sqlite3
from tkinter import PhotoImage
from tkinter import ttk
 
 
 
 
#Base de datos de control de Usuarios
def BaseRegistroU():
    Conexion = sqlite3.connect("Base Registro_de_Usuario")
    miCursor = Conexion.cursor()
 
    try:
        miCursor.execute('''
        CREATE TABLE DATOSUSUARIO (
        ID INTEGER PRIMARY KEY AUTOINCREMENT,
        Usuario VARCHAR(50),
        Departamento VARCHAR(50),
        TipoU VARCHAR(50),   
        Contra VARCHAR(50))
        ''')
        messagebox.showinfo("AVISO", "La Base de datos fue creada")
        prec=messagebox.askquestion("Aviso","¿Desea continuar?")
 
        if prec=="yes":
            I.destroy()
            VentanaU()
        else:
            I.destroy()
    except:
        messagebox.showwarning("AVISO", "La Base de datos funciona correctamente")
        prec = messagebox.askquestion("Aviso", "¿Desea continuar?")
 
        if prec == "yes":
            I.destroy()
            VentanaU()
        else:
            I.destroy()
 
 
#---------------------------------------------------------------------
 
 
 
 
 
 
 
#Aviso de integrantes
def PreL():
    messagebox.showinfo("Integrantes","Miguel Alejandro Isla Villacaña\n\nDaniel Gaytan Davila\n\nJuan Miguel Reyes Robledo")
 
#---------------------------------------------------------------------
 
 
 
def VentanaR():
    def CrearU():
        miConexion = sqlite3.connect("Base Registro_de_Usuario")
 
        miCursor = miConexion.cursor()
 
 
        miCursor.execute("INSERT INTO DATOSUSUARIO VALUES (NULL, '" + miU.get() +
                         "','" + miC.get() +"')")
 
        miConexion.commit()
 
        messagebox.showinfo("Base de Datos", "Usuario Registrado con exito")
 
 
 
 
 
    VR=Tk()
    VR.resizable(0,0)
    VR.title("Registrar Cuenta")
    VR.iconbitmap("iconop.ico")
    VR.geometry("650x650+370+25")
    VR.config(bg="black")
    #--------Imagen de fondo----------
    Logo = PhotoImage(file="LogoRU.png")
    Label(VR, image=Logo, bg='black').place(x=0,y=0)
 
    miU = StringVar()
    miC = StringVar
    miD = StringVar()
    miTU = StringVar()
 
    # -----------Label------------
    lb1 = Label(VR, text="Usuario:")
    lb1.place(x=80, y=180)
    lb1.config(width=10, font='Helvetica 20 bold', relief=RIDGE)
 
    lb2 = Label(VR, text="Contraseña:", relief=RIDGE)
    lb2.place(x=80, y=240)
    lb2.config(width=10, font='Helvetica 20 bold')
 
    #-------Cajas de texto---------
    CuadroU = Entry(VR, textvariable=miU, font='Helvetica 20 bold', width=14)
    CuadroU.place(x=270, y=180)
 
    CuadroC = Entry(VR, textvariable=miC, font='Helvetica 20 bold', width=14)
    CuadroC.place(x=270, y=240)
    CuadroC.config(show="*")
 
    #--------Comobo Box---------
    CBD= ttk.Combobox(VR,state="readonly")#Creamos el comobobox y lo ponemos que solo pueda leer para que no se pueda escibir en el
    CBD.place(x=80,y=320)
    CBD ['values'] = ('Produccion','Ventas','Personal','Franquicias','Mermas')
    CBD.set("Departamentos")#Establemos el valor que va a tener al inicio
    CBD.config(width=25, font='Helvetica 20 bold')
 
    CBU= ttk.Combobox(VR,state="readonly")  # Creamos el comobobox y lo ponemos que solo pueda leer para que no se pueda escibir en el
    CBU.place(x=80, y=380)
    CBU['values'] = ('Empleado','Administrador')
    CBU.set("Tipo de cuenta")  # Establemos el valor que va a tener al inicio
    CBU.config(width=25, font='Helvetica 20 bold')
 
 
    #----switch Departamento-----
    if CBD.get() == "Produccion":
        miD="Produccion"
    elif CBD.get() == "Ventas":
        miD="Ventas"
    elif CBD.get() == "Personal":
        miD="Personal"
    elif CBD.get() == "Franquicias":
        miD="Franquicias"
    elif CBD.get() == "Mermas":
        miD="Mermas"
 
    #---Switch Usuario----
    if CBU.get() == "Empleado":
        miTU="Empleado"
    elif CBU.get() == "Administrador":
        miTU="Administrador"
 
 
 
    #------Botones------
    botonRF = Button(VR, text="Crear", command=CrearU)
    botonRF.place(x=80, y=580)
    botonRF.config(width=12, height=2, font='Helvetica 10 bold', relief=RIDGE)
 
 
 
 
    VR.mainloop()
 
 
 
 
 
 
#---------------------------------------------------
 
 
 
def VentanaU():
    VU=Tk()
    VU.resizable(0,0)
    VU.title("Inicio de Sesion")
    VU.iconbitmap("iconop.ico")
    VU.geometry("650x650+370+25")
    VU.config(bg="black")
 
 
 
    #-----------Label------------
    lb1 = Label(VU, text="Usuario:")
    lb1.place(x=105, y=440)
    lb1.config(width=10, font='Helvetica 20 bold',relief=RIDGE)
 
    lb2 = Label(VU, text="Contraseña:",relief=RIDGE)
    lb2.place(x=105, y=500)
    lb2.config(width=10,font='Helvetica 20 bold')
 
    #-----Cajas de texto-----
    CuadroU = Entry(VU, textvariable=miUsuario, font='Helvetica 20 bold', width=14)
    CuadroU.place(x=290, y=440)
 
    CuadroC = Entry(VU, textvariable=miContra, font='Helvetica 20 bold', width=14)
    CuadroC.place(x=290, y=500)
    CuadroC.config(show="*")
 
 
 
    def cerrarVU():
        VU.destroy()
        VentanaR()
 
 
 
    #----------------------Botones---------
 
    botonR = Button(VU, text="Registrarse", command=cerrarVU)
    botonR.place(x=180, y=590)
    botonR.config(width=12, height=2, font='Helvetica 10 bold', relief=RIDGE)
 
    botonC = Button(VU, text="Continuar")
    botonC.place(x=350,y=590)
    botonC.config(width=12, height=2, font='Helvetica 10 bold', relief=RIDGE)
 
 
 
    #Logo Usuario
    img = PhotoImage(file="LogoUP.png")
    botonIm = Button(VU, image=img,width=400, height=400,relief=FLAT, command=PreL, bg='black').place(x=118,y=10)
    VU.mainloop()
 
 
#---------------------------------------------------------------------
 
 
 
#----------------------------Ventana Inicio Programa-----------------
I=Tk()
I.resizable(0,0)
I.title("Inicio")
I.iconbitmap("iconop.ico")
I.geometry("1366x700+0+0")
 
 
miUsuario = StringVar()
miContra = StringVar
miDepartamento = StringVar()
miTipoU = StringVar ()
 
 
miI=Frame(I, width=650, height=650)
miI.pack()
Logo=PhotoImage(file="logo.png")
Label(miI, image=Logo).pack()
 
BotonInicio=Button(miI, text="Inicio", command=BaseRegistroU)
BotonInicio.config(width=10, height=1, font='Helvetica 40 bold', relief=RIDGE)
BotonInicio.pack()
 
 
 
I.mainloop()
#--------------------------------------------------------------------
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
sin imagen de perfil
Val: 2.808
Oro
Ha mantenido su posición en Python (en relación al último mes)
Gráfica de Python

TypeError: get() missing 1 required positional argument: "self"

Publicado por tincopasan (1082 intervenciones) el 14/11/2019 12:04:51
hola:
está muy bien que quieras aprender y hacer scripts, pero ese código además de ilegible te va a dar errores por todos lados.
te recomiendo que a medida que comienzas proyectos más grandes seas mucho más organizado y comiences con el uso de clases.
Más allá de eso, si bien pusiste el error no pusiste el número de línea y hay que revisar esa chorrada de código, la próxima vez pon ambas cosas.
En este caso el error proviene de la línea 88:

1
miC = StringVar

si te fijas falta asignar la función con parentesis ()

1
miC = StringVar()

Saludos y a seguir revisando ese código para que esté totalmente funcional, organizado y legible.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
Imágen de perfil de Miguel
Val: 4
Ha disminuido su posición en 20 puestos en Python (en relación al último mes)
Gráfica de Python

TypeError: get() missing 1 required positional argument: "self"

Publicado por Miguel (3 intervenciones) el 14/11/2019 17:52:32
Lo de la linea 88 ya lo puse bien y me marca error ahora en la linea 67
Perdón por el orden es la primera vez que programo en python y necesito acabar este programa para mañana asique estoy apurado y no le tome relevancia al orden
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar