Skip to content
Snippets Groups Projects

Testing branch

2 files
+ 69
4
Compare changes
  • Side-by-side
  • Inline

Files

+ 29
1
from kivy.app import App
from kivy.modules import inspector # For inspection.
from kivy.core.window import Window # For inspection.
from kivy.uix.behaviors import ToggleButtonBehavior
__app_package__ = 'edu.unl.cse.soft161.order'
__app__ = 'Order Meal'
@@ -8,11 +9,38 @@ __version__ = '0.1'
__flags__ = ['--bootstrap=sdl2', '--requirements=python2,kivy', '--orientation=landscape']
class OrderApp(App):
class OrderApp(App, ToggleButtonBehavior):
order_total = 0.00
combo_order = False
def build(self):
inspector.create_inspector(Window, self) # For inspection (press control-e to toggle).
def entree_button(self, widget, state):
if widget == 'five_piece' and state == 'down':
self.order_total = 5.0
elif widget == 'sandwich' and state == 'down':
self.order_total = 5.0
elif widget == 'four_piece' and state == 'down':
self.order_total = 4.0
elif state == 'normal':
self.order_total = 0.0
if self.combo_order and state != 'normal':
self.order_total += 3.0
def combo_button(self, state):
if state == 'down':
if self.order_total == 0.0:
self.combo_order = True
else:
self.order_total += 3.0
self.combo_order = True
if state == 'normal' and self.combo_order:
self.order_total -= 3.0
self.combo_order = False
def update_total(self):
self.root.ids.total.text = 'Total: $%.2f' % self.order_total
if __name__ == '__main__':
app = OrderApp()
app.run()
Loading