Skip to content
Snippets Groups Projects
Commit 6d6149f8 authored by Adrian Reza  Ariffin's avatar Adrian Reza Ariffin
Browse files

Program completed

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
__app_package__ = 'edu.unl.cse.soft161.order' __app_package__ = 'edu.unl.cse.soft161.order'
__app__ = 'Order Meal' __app__ = 'Order Meal'
__version__ = '0.1' __version__ = '0.1'
...@@ -12,6 +12,27 @@ class OrderApp(App): ...@@ -12,6 +12,27 @@ 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).
money = NumericProperty(10)
total_price = NumericProperty(0)
chicken_price = 4
ham_price= 4
def chicken_buy(self):
self.total_price+=4
def beef_buy(self):
self.total_price+=4
def ham_buy(self):
self.total_price+=4
def checkout(self):
self.money=self.money-self.total_price
self.total_price=0
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: 'UNL Sandwich Shop'
BoxLayout:
Label:
size_hint: (1, 0.25)
text: 'Chicken'
Button:
id: chicken_purchase_button
size_hint: (1, 0.25)
text: 'Purchase'
on_press: app.chicken_buy()
BoxLayout:
Label:
size_hint: (1, 0.25)
text: 'Beef'
Button:
id: beef_purchase_button
size_hint: (1, 0.25)
text: 'Purchase'
on_press: app.beef_buy()
BoxLayout:
Label:
size_hint: (1, 0.25)
text: 'Ham'
Button:
id: ham_purchase_button
size_hint: (1, 0.25)
text: 'Purchase'
on_press: app.ham_buy()
BoxLayout:
Label:
font_size:'24sp'
text: 'Money'
Label:
text: '$'+str(app.money)
BoxLayout:
Label:
font_size:'24sp'
text: 'Total Price'
Label:
text: '$'+str(app.total_price)
BoxLayout:
Button:
text: 'Checkout'
on_press: app.checkout()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment