Advertisement
Nicolas_Pinilla

Untitled

Oct 4th, 2021
435
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.22 KB | None | 0 0
  1.  
  2. from pathlib import Path
  3. from tkinter import Tk, Canvas, Entry, Text, Button, PhotoImage,messagebox
  4. import time, os ,sys
  5.  
  6.  
  7. OUTPUT_PATH = Path(__file__).parent
  8. ASSETS_PATH = OUTPUT_PATH / Path("./assets/final")
  9.  
  10.  
  11. def relative_to_assets(path: str) -> Path:
  12.     return ASSETS_PATH / Path(path)
  13.  
  14. def votado():
  15.     messagebox.showinfo("Voto Registrado", "Gracias, su voto ah sido registrado.")
  16.     time.sleep(5)
  17.     sys.exit(0)
  18.  
  19.  
  20. window = Tk()
  21.  
  22. window.geometry("1440x1024")
  23. window.configure(bg = "#FFFFFF")
  24. window.title("Sistema de votación")
  25.  
  26.  
  27. canvas = Canvas(
  28.     window,
  29.     bg = "#FFFFFF",
  30.     height = 1024,
  31.     width = 1440,
  32.     bd = 0,
  33.     highlightthickness = 0,
  34.     relief = "ridge"
  35. )
  36.  
  37. canvas.place(x = 0, y = 0)
  38. image_image_1 = PhotoImage(
  39.     file=relative_to_assets("image_1.png"))
  40. image_1 = canvas.create_image(
  41.     720.0,
  42.     512.0,
  43.     image=image_image_1
  44. )
  45.  
  46. canvas.create_text(
  47.     76.0,
  48.     66.0,
  49.     anchor="nw",
  50.     text="Sistema de votación",
  51.     fill="#FFFFFF",
  52.     font=("Roboto Bold", 22 * -1)
  53. )
  54.  
  55. canvas.create_text(
  56.     1051.0,
  57.     648.0,
  58.     anchor="nw",
  59.     text="Opcion 3",
  60.     fill="#FFFFFF",
  61.     font=("Roboto Bold", 22 * -1)
  62. )
  63.  
  64. button_image_1 = PhotoImage(
  65.     file=relative_to_assets("button_1.png"))
  66. button_1 = Button(
  67.     image=button_image_1,
  68.     borderwidth=0,
  69.     highlightthickness=0,
  70.     command=votado,
  71.     relief="flat"
  72. )
  73. button_1.place(
  74.     x=945.0,
  75.     y=692.0,
  76.     width=300.0,
  77.     height=75.0
  78. )
  79.  
  80. image_image_2 = PhotoImage(
  81.     file=relative_to_assets("image_2.png"))
  82. image_2 = canvas.create_image(
  83.     1086.0,
  84.     415.0,
  85.     image=image_image_2
  86. )
  87.  
  88. canvas.create_text(
  89.     685.0,
  90.     648.0,
  91.     anchor="nw",
  92.     text="Opcion 2",
  93.     fill="#FFFFFF",
  94.     font=("Roboto Bold", 22 * -1)
  95. )
  96.  
  97. button_image_2 = PhotoImage(
  98.     file=relative_to_assets("button_2.png"))
  99. button_2 = Button(
  100.     image=button_image_2,
  101.     borderwidth=0,
  102.     highlightthickness=0,
  103.     command=votado,
  104.     relief="flat"
  105. )
  106. button_2.place(
  107.     x=579.0,
  108.     y=692.0,
  109.     width=300.0,
  110.     height=75.0
  111. )
  112.  
  113. image_image_3 = PhotoImage(
  114.     file=relative_to_assets("image_3.png"))
  115. image_3 = canvas.create_image(
  116.     720.0,
  117.     415.0,
  118.     image=image_image_3
  119. )
  120.  
  121. canvas.create_text(
  122.     319.0,
  123.     648.0,
  124.     anchor="nw",
  125.     text="Opcion 1",
  126.     fill="#FFFFFF",
  127.     font=("Roboto Bold", 22 * -1)
  128. )
  129.  
  130. button_image_3 = PhotoImage(
  131.     file=relative_to_assets("button_3.png"))
  132. button_3 = Button(
  133.     image=button_image_3,
  134.     borderwidth=0,
  135.     highlightthickness=0,
  136.     command=votado,
  137.     relief="flat"
  138. )
  139. button_3.place(
  140.     x=213.0,
  141.     y=692.0,
  142.     width=300.0,
  143.     height=75.0
  144. )
  145.  
  146. image_image_4 = PhotoImage(
  147.     file=relative_to_assets("image_4.png"))
  148. image_4 = canvas.create_image(
  149.     354.0,
  150.     415.0,
  151.     image=image_image_4
  152. )
  153.  
  154. image_image_5 = PhotoImage(
  155.     file=relative_to_assets("image_5.png"))
  156. image_5 = canvas.create_image(
  157.     720.0,
  158.     981.0,
  159.     image=image_image_5
  160. )
  161.  
  162. canvas.create_text(
  163.     30.0,
  164.     968.0,
  165.     anchor="nw",
  166.     text="Creado por : Nicolas Pinilla, Cristian Lema, Diego ochoa, Carlos Ramos",
  167.     fill="#000000",
  168.     font=("Roboto Bold", 22 * -1)
  169. )
  170. window.resizable(False, False)
  171. window.mainloop()
  172.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement