Skip to content
Snippets Groups Projects
Commit f93d5476 authored by Jacob Ryan Petersen's avatar Jacob Ryan Petersen
Browse files

Updated meal order app

parent 1f0ddda5
No related branches found
No related tags found
No related merge requests found
from kivy.app import App from kivy.app import App
from kivy.modules import inspector # For inspection. from kivy.modules import inspector # For inspection.
from kivy.core.window import Window # For inspection. from kivy.core.window import Window # For inspection.
from kivy.properties import BooleanProperty, NumericProperty
__app_package__ = 'edu.unl.cse.soft161.order' __app_package__ = 'edu.unl.cse.soft161.order'
__app__ = 'Order Meal' __app__ = 'Order Meal'
...@@ -12,6 +13,21 @@ class OrderApp(App): ...@@ -12,6 +13,21 @@ class OrderApp(App):
def build(self): def build(self):
inspector.create_inspector(Window, self) # For inspection (press control-e to toggle). inspector.create_inspector(Window, self) # For inspection (press control-e to toggle).
price = NumericProperty(11.00)
cheese_price = NumericProperty(0.00)
def meat_topping(self):
self.price += 1.75
def topping(self):
self.price += 1.25
def update_cheese(self):
if self.root.ids.cheese_slider.value > 50:
self.cheese_price = 1.50
else:
self.cheese_price = 0.00
if __name__ == '__main__': if __name__ == '__main__':
app = OrderApp() app = OrderApp()
......
BoxLayout: BoxLayout:
orientation: 'vertical' orientation: 'vertical'
Label: Label:
text: '[Your meal-ordering GUI here]' text: 'Online Pizza Order'
size_hint: (1, 0.25)
color: (1, 0, 0, 1)
font_size: '32sp'
BoxLayout:
orientation: 'vertical'
Label:
text: 'Cheese'
BoxLayout:
orientation: 'horizontal'
Label:
text: 'Less'
Slider:
range: (0, 100)
value: 50
id: cheese_slider
on_value_pos: app.update_cheese()
Label:
text: 'More'
Label:
id: cheese_label
text: str(int(cheese_slider.value)) + '%'
BoxLayout:
orientation: 'vertical'
size_hint: (1, 0.3)
Label:
text: 'Sauce'
font_size: '24sp'
BoxLayout:
orientation: 'vertical'
BoxLayout:
orientation: 'horizontal'
CheckBox:
group: 'sauce'
Label:
text: 'Marinara'
BoxLayout:
orientation: 'horizontal'
CheckBox:
group: 'sauce'
Label:
text: 'Barbecue'
BoxLayout:
orientation: 'vertical'
Label:
text: 'Toppings'
font_size: '24sp'
BoxLayout:
orientation: 'horizontal'
Button:
on_press: app.meat_topping()
text: 'Pepperoni'
BoxLayout:
orientation: 'horizontal'
Button:
on_press: app.topping()
text: 'Pineapple'
BoxLayout:
orientation: 'horizontal'
Button:
on_press: app.topping()
text: 'Mushrooms'
BoxLayout:
orientation: 'horizontal'
Button:
on_press: app.topping()
text: 'Olives'
BoxLayout:
orientation: 'horizontal'
Button:
on_press: app.meat_topping()
text: 'Bacon'
BoxLayout:
orientation: 'horizontal'
size_hint: (1, 0.25)
BoxLayout:
Label:
text: '$' + str(app.price + app.cheese_price)
Button:
text: 'Order Now'
font_size: '18sp'
color: (0.25, 0.5, 1, 1)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment