Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## Define constants ##
- # Pump flowrate
- # flowrate = 100 mL per min
- flowrate_minute = 100
- flowrate_second = flowrate_minute / 60
- #time to pour 30ml
- print(30 / flowrate_second)
- #time to pour 220ml
- print(220 / flowrate_second)
- # Volumes for drinks in mL
- standard_drink = 30
- glass = 250
- # Imports
- #import RPi.GPIO as GPIO
- from tkinter import *
- # Initialise parts
- #Raspberry Pi
- #RPIO.setmode(GPIO.BCM)
- #Screen
- #Relay?
- #Pumps
- # Drinks list
- drink_list = [
- {
- "name": "Scotch & Coke",
- "ingredients": {
- "scotch": 30,
- "coke": 220
- }
- },
- {
- "name": "Screwdriver",
- "ingredients": {
- "vodka": 30,
- "orange_juice": 220
- }
- },
- {
- "name": "Vodka & Lemonade",
- "ingredients": {
- "vodka": 30,
- "lemonade": 220
- }
- },
- {
- "name": "Rum & Coke",
- "ingredients": {
- "rum": 30,
- "coke": 220
- }
- }
- ,
- {
- "name": "Gin & Juice",
- "ingredients": {
- "gin": 30,
- "orange_juice": 220
- }
- }
- ,
- {
- "name": "Vodka & Coke",
- "ingredients": {
- "vodka": 30,
- "coke": 220
- }
- }
- ,
- {
- "name": "Cleaning cycle",
- "ingredients": {
- "bleach": 15,
- "water": 4000
- }
- }
- ]
- # Fluids in pump numbers
- # pump_1 = coke
- # pump_2 = lemonade
- # pump_3 = orange_juice
- # pump_4 = vodka
- # pump_5 = scotch
- # pump_6 = rum
- # Pour drink
- def pour_drink(drink):
- return True
- # Cleanup and poweroff
- def close():
- #GPIO.cleanup()
- win.destroy()
- # Menu GUI
- win = Tk()
- win.configure(background='black')
- win.attributes('-fullscreen', True)
- win.title('test')
- button1 = Button(win, width=14, height=3, bg='black', fg='white', command= lambda: pour_drink(scotch_coke), text='Scotch and Coke')
- button1.grid(row=0,column=1)
- button2 = Button(win, width=14, height=3, bg='black', fg='white', command= lambda: pour_drink(screwdriver), text='Screwdriver')
- button2.grid(row=0,column=2)
- button3 = Button(win, width=14, height=3, bg='black', fg='white', command= lambda: pour_drink(vodka_lemonade), text='Vodka Lemonade')
- button3.grid(row=0,column=3)
- button4 = Button(win, width=14, height=3, bg='black', fg='white', command= lambda: pour_drink(rum_coke), text='Rum and Coke')
- button4.grid(row=1,column=1)
- button5 = Button(win, width=14, height=3, bg='black', fg='white', command= lambda: pour_drink(gin_juice), text='Gin and Juice')
- button5.grid(row=1,column=2)
- button6 = Button(win, width=14, height=3, bg='black', fg='white', command= lambda: pour_drink(vodka_coke), text='Vodka and Coke')
- button6.grid(row=1,column=3)
- button7 = Button(win, width=14, height=3, bg='black', fg='white', command= lambda: pour_drink(cleaning), text='Cleaning cycle')
- button7.grid(row=2,column=1)
- button8 = Button(win, width=14, height=3, bg='black', fg='white', command= close, text='Power off')
- button8.grid(row=2,column=3)
- win.protocol("WM_DELETE_WINDOW", close) # exit cleanly
- win.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement