Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Ethan Penn
meal-ordering-app
Commits
d03683c3
Commit
d03683c3
authored
Jan 25, 2017
by
Ethan Penn
Browse files
Final commit for the Order App due Friday
parent
1f0ddda5
Changes
2
Hide whitespace changes
Inline
Side-by-side
main.py
View file @
d03683c3
from
kivy.app
import
App
from
kivy.modules
import
inspector
# For inspection.
from
kivy.core.window
import
Window
# For inspection.
from
kivy.properties
import
NumericProperty
__app_package__
=
'edu.unl.cse.soft161.order'
__app__
=
'Order Meal'
...
...
@@ -9,9 +10,34 @@ __flags__ = ['--bootstrap=sdl2', '--requirements=python2,kivy', '--orientation=l
class
OrderApp
(
App
):
total
=
NumericProperty
(
0.00
)
def
build
(
self
):
inspector
.
create_inspector
(
Window
,
self
)
# For inspection (press control-e to toggle).
def
update_total
(
self
):
self
.
total
=
0.00
if
self
.
root
.
ids
.
spaghetti
.
active
:
self
.
total
+=
4.99
if
self
.
root
.
ids
.
penne_mostaccioli
.
active
:
self
.
total
+=
9000.01
if
self
.
root
.
ids
.
angel_hair
.
active
:
self
.
total
+=
0.01
if
self
.
root
.
ids
.
bow_tie
.
active
:
self
.
total
+=
2.99
if
self
.
root
.
ids
.
meat
.
active
:
self
.
total
+=
3.48
if
self
.
root
.
ids
.
marinara
.
active
:
self
.
total
+=
2.07
if
self
.
root
.
ids
.
alfredo
.
active
:
self
.
total
+=
6.66
if
__name__
==
'__main__'
:
app
=
OrderApp
()
...
...
order.kv
View file @
d03683c3
BoxLayout:
orientation: 'vertical'
Label:
text: '[Your meal-ordering GUI here]'
text: 'Pastaeria'
size_hint: (1,0.1)
BoxLayout:
orientation: 'horizontal'
BoxLayout:
orientation: 'vertical'
Label:
text: 'Pasta'
BoxLayout:
orientation: 'horizontal'
Label:
text: 'Spaghetti'
CheckBox:
id: spaghetti
on_active: app.update_total()
BoxLayout:
orientation: 'horizontal'
Label:
text: 'Penne Mostaccioli'
CheckBox:
id: penne_mostaccioli
on_active: app.update_total()
BoxLayout:
orientation: 'horizontal'
Label:
text: 'Angel Hair'
CheckBox:
id: angel_hair
on_active: app.update_total()
BoxLayout:
orientation: 'horizontal'
Label:
text: 'Bow Tie'
CheckBox:
id: bow_tie
on_active: app.update_total()
BoxLayout:
orientation: 'vertical'
Label:
text: 'Sauce'
BoxLayout:
orientation: 'horizontal'
Label:
text: 'Meat'
CheckBox:
id: meat
on_active: app.update_total()
BoxLayout:
orientation: 'horizontal'
Label:
text: 'Marinara'
CheckBox:
id: marinara
on_active: app.update_total()
BoxLayout:
orientation: 'horizontal'
Label:
text: 'Alfredo'
CheckBox:
id: alfredo
on_active: app.update_total()
BoxLayout:
orientation: 'vertical'
Label:
text: 'Total: ' + str(app.total)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment