1
+ import tkinter as tk
2
+ from tkinter import ttk
3
+
4
+ # Crear la ventana principal
5
+ window = tk .Tk ()
6
+ window .title ("Sistema | Iniciar Sesión" )
7
+
8
+ # Configurar el tamaño de la ventana
9
+ window .geometry ("375x700" )
10
+
11
+ # Configurar color de fondo de ventana
12
+ window .configure (bg = "#1B578C" )
13
+
14
+ # Crear un marco para centrar el contenido
15
+ index = tk .Frame (window )
16
+ index .pack (expand = True )
17
+ index .configure (bg = "#1B578C" )
18
+
19
+ # Título
20
+ titleLogin = tk .Label (index , font = ("Arial" , 20 ), fg = "#F2E2CE" , text = "Iniciar Sesión" )
21
+ titleLogin .pack (pady = 25 , padx = 10 , fill = "both" , expand = True )
22
+ titleLogin .configure (bg = "#1B578C" )
23
+
24
+ # Label de Correo
25
+ emailLabel = tk .Label (index , font = ("Arial" , 12 ), fg = "#F2E2CE" , text = "Correo Electrónico:" )
26
+ emailLabel .pack (pady = 10 , padx = 5 , fill = "both" , expand = True )
27
+ emailLabel .configure (bg = "#1B578C" )
28
+
29
+ # Entrada de correo
30
+ emailInput = tk .Entry (index , font = ("Arial" , 13 ), fg = "black" ) #Fuente, tamaño, color
31
+ emailInput .pack (pady = 8 , padx = 10 , fill = "both" , expand = True ) # Rellenar y expandir para centrar
32
+
33
+ # Label de Contraseña
34
+ passwordLabel = tk .Label (index , font = ("Arial" , 12 ), fg = "#F2E2CE" , text = "Contraseña:" )
35
+ passwordLabel .pack (pady = 5 , padx = 5 , fill = "both" , expand = True )
36
+ passwordLabel .configure (bg = "#1B578C" )
37
+
38
+ # Entrada de Contraseña
39
+ passwordInput = tk .Entry (index , font = ("Arial" , 13 ), fg = "black" ) #Fuente, tamaño, color
40
+ passwordInput .pack (pady = 5 , padx = 10 , fill = "both" , expand = True ) # Rellenar y expandir para centrar
41
+
42
+ # Función para ir a la Página principal de Admin
43
+ def adminView ():
44
+ import admin as tk # Importación Ventana Página Principal de Administrador
45
+
46
+ # Crear un botón para Enviar Formulario
47
+ loginButton = tk .Button (index , text = "Ingresar" , command = adminView ) # El command hace que se abra la otra ventana
48
+ loginButton .pack (pady = 40 , padx = 10 , fill = "both" )
49
+
50
+ def activeHover (event ):
51
+ loginButton .config (bg = "#ADC5D9" , fg = "black" )
52
+
53
+ def inactiveHover (event ):
54
+ loginButton .config (bg = "#7E9ABF" , fg = "black" )
55
+
56
+ # Enlazar eventos de ratón para cambiar la apariencia en el hover
57
+ loginButton .bind ("<Enter>" , activeHover )
58
+ loginButton .bind ("<Leave>" , inactiveHover )
59
+
60
+ # Iniciar el bucle principal de la aplicación
61
+ window .mainloop ()
0 commit comments