Skip to content
Snippets Groups Projects
Commit e1748b8c authored by joshmartin0212@gmail.com's avatar joshmartin0212@gmail.com
Browse files

Added code for an interactive meal ordering 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 NumericProperty
from kivy.uix import button
__app_package__ = 'edu.unl.cse.soft161.order' __app_package__ = 'edu.unl.cse.soft161.order'
__app__ = 'Order Meal' __app__ = 'Order Meal'
...@@ -9,9 +12,28 @@ __flags__ = ['--bootstrap=sdl2', '--requirements=python2,kivy', '--orientation=l ...@@ -9,9 +12,28 @@ __flags__ = ['--bootstrap=sdl2', '--requirements=python2,kivy', '--orientation=l
class OrderApp(App): class OrderApp(App):
charge_total = 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 update_bite_charge(self):
app.charge_total+=1.5
def update_mega_charge(self):
app.charge_total+=3
def update_giga_charge(self):
app.charge_total+=8.75
def update_tera_charge(self):
app.charge_total+=25
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: 'Bits and Bites'
font_size: 45
bold: True
Label:
text: 'By: Josh Martin'
font_size: 20
Label:
text: 'Subtotal: $'+ str(app.charge_total)
Button:
text: 'Restart Order'
on_press: app.charge_total=0.0
Button:
id: bite
text: 'Add to order: One Bite - $1.50'
on_press: app.update_bite_charge()
Button:
id: mega
text: 'Add to order: One Megabite - $3.00'
on_press: app.update_mega_charge()
Button:
id: giga
text: 'Add to order: One Gigabite - $8.75'
on_press: app.update_giga_charge()
Button:
id: tera
text: 'Add to order: One Terabite - $25.00'
on_press: app.update_tera_charge()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment