Advertisement
Guest User

Untitled

a guest
May 27th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.87 KB | None | 0 0
  1. ## Define constants ##
  2. # Pump flowrate
  3. # flowrate = 100 mL per min
  4. flowrate_minute = 100
  5. flowrate_second = flowrate_minute / 60
  6.  
  7. #time to pour 30ml
  8. print(30 / flowrate_second)
  9. #time to pour 220ml
  10. print(220 / flowrate_second)
  11.  
  12. # Volumes for drinks in mL
  13. standard_drink = 30
  14. glass = 250
  15.  
  16. # Imports
  17. #import RPi.GPIO as GPIO
  18. from tkinter import *
  19.  
  20.  
  21. # Initialise parts
  22. #Raspberry Pi
  23. #RPIO.setmode(GPIO.BCM)
  24. #Screen
  25. #Relay?
  26. #Pumps
  27.  
  28. # Drinks list
  29. drink_list = [
  30. {
  31. "name": "Scotch & Coke",
  32. "ingredients": {
  33. "scotch": 30,
  34. "coke": 220
  35. }
  36. },
  37. {
  38. "name": "Screwdriver",
  39. "ingredients": {
  40. "vodka": 30,
  41. "orange_juice": 220
  42. }
  43. },
  44. {
  45. "name": "Vodka & Lemonade",
  46. "ingredients": {
  47. "vodka": 30,
  48. "lemonade": 220
  49. }
  50. },
  51. {
  52. "name": "Rum & Coke",
  53. "ingredients": {
  54. "rum": 30,
  55. "coke": 220
  56. }
  57. }
  58. ,
  59. {
  60. "name": "Gin & Juice",
  61. "ingredients": {
  62. "gin": 30,
  63. "orange_juice": 220
  64. }
  65. }
  66. ,
  67. {
  68. "name": "Vodka & Coke",
  69. "ingredients": {
  70. "vodka": 30,
  71. "coke": 220
  72. }
  73. }
  74. ,
  75. {
  76. "name": "Cleaning cycle",
  77. "ingredients": {
  78. "bleach": 15,
  79. "water": 4000
  80. }
  81. }
  82. ]
  83.  
  84. # Fluids in pump numbers
  85. # pump_1 = coke
  86. # pump_2 = lemonade
  87. # pump_3 = orange_juice
  88. # pump_4 = vodka
  89. # pump_5 = scotch
  90. # pump_6 = rum
  91.  
  92. # Pour drink
  93. def pour_drink(drink):
  94. return True
  95.  
  96. # Cleanup and poweroff
  97. def close():
  98. #GPIO.cleanup()
  99. win.destroy()
  100.  
  101.  
  102. # Menu GUI
  103. win = Tk()
  104. win.configure(background='black')
  105. win.attributes('-fullscreen', True)
  106. win.title('test')
  107. button1 = Button(win, width=14, height=3, bg='black', fg='white', command= lambda: pour_drink(scotch_coke), text='Scotch and Coke')
  108. button1.grid(row=0,column=1)
  109.  
  110. button2 = Button(win, width=14, height=3, bg='black', fg='white', command= lambda: pour_drink(screwdriver), text='Screwdriver')
  111. button2.grid(row=0,column=2)
  112.  
  113. button3 = Button(win, width=14, height=3, bg='black', fg='white', command= lambda: pour_drink(vodka_lemonade), text='Vodka Lemonade')
  114. button3.grid(row=0,column=3)
  115.  
  116. button4 = Button(win, width=14, height=3, bg='black', fg='white', command= lambda: pour_drink(rum_coke), text='Rum and Coke')
  117. button4.grid(row=1,column=1)
  118.  
  119. button5 = Button(win, width=14, height=3, bg='black', fg='white', command= lambda: pour_drink(gin_juice), text='Gin and Juice')
  120. button5.grid(row=1,column=2)
  121.  
  122. button6 = Button(win, width=14, height=3, bg='black', fg='white', command= lambda: pour_drink(vodka_coke), text='Vodka and Coke')
  123. button6.grid(row=1,column=3)
  124.  
  125. button7 = Button(win, width=14, height=3, bg='black', fg='white', command= lambda: pour_drink(cleaning), text='Cleaning cycle')
  126. button7.grid(row=2,column=1)
  127.  
  128. button8 = Button(win, width=14, height=3, bg='black', fg='white', command= close, text='Power off')
  129. button8.grid(row=2,column=3)
  130.  
  131. win.protocol("WM_DELETE_WINDOW", close) # exit cleanly
  132. win.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement