Skip to content
Snippets Groups Projects
Commit e6f7038d authored by Benjamin Lee Jahnke's avatar Benjamin Lee Jahnke
Browse files

Finished Ice Cream Ordering App.

parent 1f0ddda5
Branches
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'
...@@ -9,9 +10,39 @@ __flags__ = ['--bootstrap=sdl2', '--requirements=python2,kivy', '--orientation=l ...@@ -9,9 +10,39 @@ __flags__ = ['--bootstrap=sdl2', '--requirements=python2,kivy', '--orientation=l
class OrderApp(App): class OrderApp(App):
vanilla = NumericProperty(0.50)
cherry = NumericProperty(1.50)
chocolate = NumericProperty(1.00)
strawberry = NumericProperty(1.00)
oreo = NumericProperty(1.50)
cookie_dough = NumericProperty(1.50)
rocky_road = NumericProperty(1.50)
marshmallow = NumericProperty(1.50)
mint_chip = NumericProperty(1.50)
subtotal = NumericProperty(0.00)
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).
def addvanilla(self):
self.subtotal += self.vanilla
def addcherry(self):
self.subtotal += self.cherry
def addchocolate(self):
self.subtotal += self.chocolate
def addstrawberry(self):
self.subtotal += self.strawberry
def addoreo(self):
self.subtotal += self.oreo
def addcookie_dough(self):
self.subtotal += self.cookie_dough
def addmarshmallow(self):
self.subtotal += self.marshmallow
def addrocky_road(self):
self.subtotal += self.rocky_road
def addmint_chip(self):
self.subtotal += self.mint_chip
def new_order(self):
self.subtotal = 0
if __name__ == '__main__': if __name__ == '__main__':
app = OrderApp() app = OrderApp()
......
BoxLayout: BoxLayout:
orientation: 'vertical' orientation: 'vertical'
BoxLayout:
orientation: 'horizontal'
BoxLayout:
orientation: 'vertical'
Label:
text: "Welcome to Benny's Ice Cream"
font_size: '50sp'
Label:
text: 'Order Personalized Scooped Cones Here'
font_size: '25sp'
BoxLayout:
orientation: 'horizontal'
BoxLayout:
orientation: 'vertical'
Button:
text: 'one scoop of vanilla'
on_press: app.addvanilla()
Button:
text: 'one scoop of cherry'
on_press: app.addcherry()
Button:
text: 'one scoop of chocolate'
on_press: app.addchocolate()
BoxLayout:
orientation: 'vertical'
Button:
text: 'one scoop of strawberry'
on_press: app.addstrawberry()
Button:
text: 'one scoop of cookie dough'
on_press: app.addcookie_dough()
Button:
text: 'one scoop of oreo'
on_press: app.addoreo()
BoxLayout:
orientation: 'vertical'
Button:
text: 'one scoop of marshmallow'
on_press: app.addmarshmallow()
Button:
text: 'one scoop of rocky road'
on_press: app.addrocky_road()
Button:
text: 'one scoop of mint chip'
on_press: app.addmint_chip()
BoxLayout:
orientation: 'horizontal'
Label: Label:
text: '[Your meal-ordering GUI here]' id: subtotal
font_size: '40sp'
text: 'Subtotal is: $' + format((app.subtotal), '.2f')
BoxLayout:
orientation: 'horizontal'
Button:
id: new_order
size_hint: (.25, 1)
font_size: '20sp'
text: 'New Order'
on_press: app.new_order()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment