Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Cameron Irwin
meal-ordering-app
Commits
f0201add
Commit
f0201add
authored
Jan 28, 2017
by
Cameron Irwin
Browse files
Finished App
parent
1f0ddda5
Changes
2
Hide whitespace changes
Inline
Side-by-side
main.py
View file @
f0201add
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'
__version__
=
'0.1'
...
...
@@ -12,7 +12,30 @@ class OrderApp(App):
def
build
(
self
):
inspector
.
create_inspector
(
Window
,
self
)
# For inspection (press control-e to toggle).
total
=
NumericProperty
(
0
)
def
addDoubleDoubleToOrder
(
self
):
if
self
.
root
.
ids
.
doubleDouble
.
active
:
self
.
total
+=
6.50
print
(
self
.
total
)
if
not
self
.
root
.
ids
.
doubleDouble
.
active
:
self
.
total
-=
6.50
print
(
self
.
total
)
def
addCheeseburgerToOrder
(
self
):
if
self
.
root
.
ids
.
cheeseburger
.
active
:
self
.
total
+=
5
print
(
self
.
total
)
if
not
self
.
root
.
ids
.
cheeseburger
.
active
:
self
.
total
-=
5
print
(
self
.
total
)
def
addHamburgerToOrder
(
self
):
if
self
.
root
.
ids
.
hamburger
.
active
:
self
.
total
+=
5
print
(
self
.
total
)
if
not
self
.
root
.
ids
.
hamburger
.
active
:
self
.
total
-=
5
print
(
self
.
total
)
if
__name__
==
'__main__'
:
app
=
OrderApp
()
app
.
run
()
order.kv
View file @
f0201add
BoxLayout:
orientation: 'vertical'
Label:
text: '[Your meal-ordering GUI here]'
BoxLayout:
orientation: 'horizontal'
Label:
text: 'In-N -Out Burger'
font_size: 30
color: (0.8,0,0,1)
BoxLayout:
orientation: 'horizontal'
CheckBox:
id: doubleDouble
on_active: app.addDoubleDoubleToOrder()
Label:
text:'Double-Double'
font_size: 24
color: (0.8,0,0,1)
BoxLayout:
orientation:'horizontal'
CheckBox:
id: hamburger
on_active: app.addHamburgerToOrder()
Label:
text:'Hamburger'
font_size: 24
color: (0.8,0,0,1)
BoxLayout:
orientation: 'horizontal'
CheckBox:
id: cheeseburger
on_active: app.addCheeseburgerToOrder()
Label:
text:'Cheeseburger'
font_size: 24
color: (0.8,0,0,1)
BoxLayout:
orientation: 'horizontal'
Label:
text:'Total: $' + str(app.total)
font_size: 24
color: (0.8,0,0,1)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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