Skip to content
Snippets Groups Projects
Commit 5bfc4404 authored by Carsten James Scholle's avatar Carsten James Scholle
Browse files

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 NumericProperty
__app_package__ = 'edu.unl.cse.soft161.order' __app_package__ = 'edu.unl.cse.soft161.order'
__app__ = 'Order Meal' __app__ = 'Order Meal'
...@@ -8,10 +10,24 @@ __version__ = '0.1' ...@@ -8,10 +10,24 @@ __version__ = '0.1'
__flags__ = ['--bootstrap=sdl2', '--requirements=python2,kivy', '--orientation=landscape'] __flags__ = ['--bootstrap=sdl2', '--requirements=python2,kivy', '--orientation=landscape']
class OrderApp(App): class OrderApp(App):
price = NumericProperty(0)
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 pizza_size(self):
if self.roots.ids.small.state == 'down':
self.price = 9
if self.roots.ids.medium.state == 'down':
self.price = 11
if self.roots.ids.large.state == 'down':
self.price = 13
if self.roots.ids.extra_large.state == 'down':
self.price = 15
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: 'Papa Johns'
BoxLayout:
orientation: 'horizontal'
Label:
text: 'Choose your size'
font_size: '18sp'
ToggleButton:
id: 'small'
text: 'small'
size_hint: (.25,.5)
group: 'size'
font_size: '18sp'
ToggleButton:
id: 'medium'
text: 'medium'
size_hint: (.25,.5)
group: 'size'
font_size: '18sp'
ToggleButton:
id: 'large'
text: 'large'
size_hint: (.25,.5)
group: 'size'
font_size: '18sp'
ToggleButton:
id: 'extra_large'
text: 'extra large'
size_hint: (.25,.5)
group: 'size'
font_size: '18sp'
BoxLayout:
orientation: 'horizontal'
Label:
text: 'Choose your crust'
font_size: '20sp'
ToggleButton:
text: 'thin'
size_hint: (.33,.5)
group: 'crust'
font_size: '20sp'
ToggleButton:
text: 'regular'
size_hint: (.33,.5)
group: 'crust'
font_size: '20sp'
ToggleButton:
text: 'thick'
size_hint: (.33,.5)
group: 'crust'
font_size: '20sp'
BoxLayout:
orientation: 'horizontal'
Label:
text: 'How much sauce?'
font_size: '20sp'
ToggleButton:
text: 'normal'
size_hint: (.25,.5)
group: 'sauce'
font_size: '20sp'
ToggleButton:
text: 'light'
size_hint: (.25,.5)
group: 'sauce'
font_size: '20sp'
ToggleButton:
text: 'extra'
size_hint: (.25,.5)
group: 'sauce'
font_size: '20sp'
ToggleButton:
text: 'no sauce'
size_hint: (.25,.5)
group: 'sauce'
font_size: '20sp'
BoxLayout:
orientation: 'horizontal'
Label:
text: 'How much cheese?'
font_size: '20sp'
ToggleButton:
text: 'normal'
size_hint: (.33,.5)
group: 'cheese'
font_size: '20sp'
ToggleButton:
text: 'light'
size_hint: (.33,.5)
group: 'cheese'
font_size: '20sp'
ToggleButton:
text: 'no cheese'
size_hint: (.33,.5)
group: 'cheese'
font_size: '20sp'
BoxLayout:
orientation: 'horizontal'
Label:
text: 'Choose your toppings'
font_size: '20sp'
ToggleButton:
text: 'sausage'
size_hint: (.33,.5)
font_size: '20sp'
group: 'toppings'
ToggleButton:
text: 'pepperoni'
size_hint: (.33,.5)
font_size: '20sp'
group: 'toppings'
ToggleButton:
text: 'veggies'
size_hint: (.33,.5)
font_size: '20sp'
group: 'toppings'
Label:
text: 'Total:'
font_size: '20sp'
Label:
id: 'total'
text: '$' + str(app.price())
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment