Advertisement
Vasilena

diplomna

Mar 30th, 2023 (edited)
981
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.64 KB | None | 0 0
  1. def close():
  2.     root.destroy()
  3.  
  4. # root setup
  5. background_color = '#999da0'
  6. root = tk.Tk()
  7. root.attributes('-fullscreen', True)
  8. root.title("Control Panel")
  9. root.configure(background='#999da0')
  10.  
  11. screen_width = root.winfo_screenwidth() #1920
  12. screen_height = root.winfo_screenheight() #1080
  13.  
  14. # manual mode
  15. manual = Label(root, text="MANUAL MODE", font=('Arial', 15), bg=background_color, fg="black")
  16. manual.place(x=(screen_width/3)*2, y=screen_height/10)
  17.  
  18. pump_one_on_btn = Button(root, text="1 ON", font=("Arial", 15, "bold"), command, bg="red", fg="white")
  19. pump_one_on_btn.place(x=1300, y=200)
  20. pump_one_off_btn = Button(root, text="1 OFF", font=("Arial", 15, "bold"), command, bg="red", fg="white")
  21. pump_one_off_btn.place(x=1300, y=250)
  22.  
  23. pump_two_on_btn = Button(root, text="2 ON", font=("Arial", 15, "bold"), bg="red", fg="white")
  24. pump_two_on_btn.place(x=1800, y=200)
  25. pump_two_off_btn = Button(root, text="2 OFF", font=("Arial", 15, "bold"), bg="red", fg="white")
  26. pump_two_off_btn.place(x=1800, y=250)
  27.  
  28. # exit program button
  29. exit_btn = Button(root, text="X", height=1, width=2, font=("Arial", 15, "bold"), command=close, bg="red", fg="white")
  30. exit_btn.place(x=screen_width-55, y = screen_height-(screen_height-5))
  31.  
  32. # automatic mode
  33. automatic_btn = Button(root, text="AUTOMATIC MODE", font=('Arial', 15), bg="white", fg="black")
  34. automatic_btn.place(x=(screen_width/3)*2, y=screen_height/8)
  35.  
  36. # canvas setup
  37. canvas = Canvas(root, width=(screen_width/3)*2, height=screen_height, bg=background_color)
  38. canvas.pack()
  39. canvas.place(bordermode=OUTSIDE)
  40.  
  41. # heading
  42. canvas.create_text(screen_width/3, screen_height/18, text='C O N T R O L  P A N E L', fill='black', font='Arial 25')
  43.  
  44. # create scale tank One
  45. canvas.create_line(40, 110, 40, 370, width=2)
  46. for i in range(6):
  47.     p = 100 - i * 20
  48.     y = 110
  49.     y = y + i*52
  50.     canvas.create_text(15, y, text=p, font=("Arial", 10, "bold"))
  51.     canvas.create_text(30, y, text="%", font=("Arial", 10, "bold"))
  52.     canvas.create_line(40, y, 50, y, width=2)
  53.  
  54. # create scale tank Two
  55. canvas.create_line(40, 450, 40, 710, width=2)
  56. for i in range(6):
  57.     p = 100-i*20
  58.     y = 450
  59.     y = y + i * 52
  60.     canvas.create_text(15, y, text=p, font=("Arial", 10, "bold"))
  61.     canvas.create_text(30, y, text="%", font=("Arial", 10, "bold"))
  62.     canvas.create_line(40, y, 50, y, width=2)
  63.  
  64. # tank One
  65. canvas.create_rectangle(60, 110, 230, 370, fill='#d9dddc')
  66. # tank One Water
  67. canvas.create_rectangle(60, 240, 230, 370, fill='blue')
  68.  
  69. # tank Two
  70. canvas.create_rectangle(60, 450, 230, 710, fill='#d9dddc')
  71. # tank Two Water
  72. canvas.create_rectangle(60, 505, 230, 710, fill='blue')
  73.  
  74. # pumpOne
  75. root.mainloop()
  76.  
  77.  
  78.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement