Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from pathlib import Path
- from tkinter import Tk, Canvas, Entry, Text, Button, PhotoImage, Toplevel,messagebox
- import time, os ,sys
- registro = {'1233892028': ['Nicolas','Pinilla','24'],'1853820738': ['Luis','Arango','50'],'8202983321': ['Julia','Cifuentes','80'] }
- OUTPUT_PATH = Path(__file__).parent
- ASSETS_PATH = OUTPUT_PATH / Path("./assets")
- def relative_to_assets(path: str) -> Path:
- return ASSETS_PATH / Path(path)
- class Usuario():
- def __init__(self,nombre,apellido,edad):
- self.nombre = str(nombre)
- self.apellido = str(apellido)
- self.edad = int(edad)
- window = Tk()
- def UpdateEntrada():
- if entry_1.get() in registro.keys():
- nombre = registro[entry_1.get()][0]
- apellido = registro[entry_1.get()][1]
- edad = registro[entry_1.get()][2]
- update = Usuario(nombre, apellido, edad)
- if update.edad < 18 or update.edad > 70:
- messagebox.showinfo("ERROR", "No se encuentra en el rango de edad permitido para votar.")
- else:
- print("Bienvenido "+ update.nombre +" "+update.apellido)
- os.system('python votación.py')
- else:
- messagebox.showinfo("ERROR", "Usuario no registrado, no puede votar.")
- window.geometry("1440x1024")
- window.configure(bg = "#FFFFFF")
- window.title("Sistema de votación")
- canvas = Canvas(
- window,
- bg = "#FFFFFF",
- height = 1024,
- width = 1440,
- bd = 0,
- highlightthickness = 0,
- relief = "ridge"
- )
- canvas.place(x = 0, y = 0)
- image_image_1 = PhotoImage(
- file=relative_to_assets("image_1.png"))
- image_1 = canvas.create_image(
- 388.0,
- 512.0,
- image=image_image_1
- )
- image_image_2 = PhotoImage(
- file=relative_to_assets("image_2.png"))
- image_2 = canvas.create_image(
- 1108.0,
- 512.0,
- image=image_image_2
- )
- canvas.create_text(
- 898.0,
- 142.0,
- anchor="nw",
- text="Sistema de votacion",
- fill="#FFFFFF",
- font=("Roboto Bold", 22 * -1)
- )
- canvas.create_text(
- 871.0,
- 302.0,
- anchor="nw",
- text="Ingrese su Cedula",
- fill="#FFFFFF",
- font=("Roboto Bold", 22 * -1)
- )
- entry_image_1 = PhotoImage(
- file=relative_to_assets("entry_1.png"))
- entry_bg_1 = canvas.create_image(
- 1132.5,
- 378.0,
- image=entry_image_1
- )
- entry_1 = Entry(
- bd=0,
- bg="#C4C4C4",
- highlightthickness=0
- )
- entry_1.place(
- x=884.0,
- y=349.0,
- width=497.0,
- height=56.0
- )
- button_image_1 = PhotoImage(
- file=relative_to_assets("button_1.png"))
- button_1 = Button(
- image=button_image_1,
- borderwidth=0,
- highlightthickness=0,
- command=UpdateEntrada,
- relief="flat"
- )
- button_1.place(
- x=983.0,
- y=489.0,
- width=300.0,
- height=75.0
- )
- image_image_3 = PhotoImage(
- file=relative_to_assets("image_3.png"))
- image_3 = canvas.create_image(
- 720.0,
- 981.0,
- image=image_image_3
- )
- canvas.create_text(
- 30.0,
- 968.0,
- anchor="nw",
- text="Creado por : Nicolas Pinilla, Cristian Lema, Diego ochoa, Carlos Ramos",
- fill="#000000",
- font=("Roboto Bold", 22 * -1)
- )
- window.resizable(False, False)
- window.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement