Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def close():
- root.destroy()
- # root setup
- background_color = '#999da0'
- root = tk.Tk()
- root.attributes('-fullscreen', True)
- root.title("Control Panel")
- root.configure(background='#999da0')
- screen_width = root.winfo_screenwidth() #1920
- screen_height = root.winfo_screenheight() #1080
- # manual mode
- manual = Label(root, text="MANUAL MODE", font=('Arial', 15), bg=background_color, fg="black")
- manual.place(x=(screen_width/3)*2, y=screen_height/10)
- pump_one_on_btn = Button(root, text="1 ON", font=("Arial", 15, "bold"), command, bg="red", fg="white")
- pump_one_on_btn.place(x=1300, y=200)
- pump_one_off_btn = Button(root, text="1 OFF", font=("Arial", 15, "bold"), command, bg="red", fg="white")
- pump_one_off_btn.place(x=1300, y=250)
- pump_two_on_btn = Button(root, text="2 ON", font=("Arial", 15, "bold"), bg="red", fg="white")
- pump_two_on_btn.place(x=1800, y=200)
- pump_two_off_btn = Button(root, text="2 OFF", font=("Arial", 15, "bold"), bg="red", fg="white")
- pump_two_off_btn.place(x=1800, y=250)
- # exit program button
- exit_btn = Button(root, text="X", height=1, width=2, font=("Arial", 15, "bold"), command=close, bg="red", fg="white")
- exit_btn.place(x=screen_width-55, y = screen_height-(screen_height-5))
- # automatic mode
- automatic_btn = Button(root, text="AUTOMATIC MODE", font=('Arial', 15), bg="white", fg="black")
- automatic_btn.place(x=(screen_width/3)*2, y=screen_height/8)
- # canvas setup
- canvas = Canvas(root, width=(screen_width/3)*2, height=screen_height, bg=background_color)
- canvas.pack()
- canvas.place(bordermode=OUTSIDE)
- # heading
- 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')
- # create scale tank One
- canvas.create_line(40, 110, 40, 370, width=2)
- for i in range(6):
- p = 100 - i * 20
- y = 110
- y = y + i*52
- canvas.create_text(15, y, text=p, font=("Arial", 10, "bold"))
- canvas.create_text(30, y, text="%", font=("Arial", 10, "bold"))
- canvas.create_line(40, y, 50, y, width=2)
- # create scale tank Two
- canvas.create_line(40, 450, 40, 710, width=2)
- for i in range(6):
- p = 100-i*20
- y = 450
- y = y + i * 52
- canvas.create_text(15, y, text=p, font=("Arial", 10, "bold"))
- canvas.create_text(30, y, text="%", font=("Arial", 10, "bold"))
- canvas.create_line(40, y, 50, y, width=2)
- # tank One
- canvas.create_rectangle(60, 110, 230, 370, fill='#d9dddc')
- # tank One Water
- canvas.create_rectangle(60, 240, 230, 370, fill='blue')
- # tank Two
- canvas.create_rectangle(60, 450, 230, 710, fill='#d9dddc')
- # tank Two Water
- canvas.create_rectangle(60, 505, 230, 710, fill='blue')
- # pumpOne
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement