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
Hallie Christine Hohbein
meal-ordering-app
Commits
46c3cd1f
Commit
46c3cd1f
authored
Feb 10, 2017
by
Hallie Hohbein
Browse files
Meal Ordering App update
parent
1f0ddda5
Changes
2
Hide whitespace changes
Inline
Side-by-side
main.py
View file @
46c3cd1f
from
kivy.app
import
App
from
kivy.modules
import
inspector
# For inspection.
from
kivy.core.window
import
Window
# For inspection.
from
kivy.uix.checkbox
import
CheckBox
from
kivy.properties
import
NumericProperty
__app_package__
=
'edu.unl.cse.soft161.order'
__app__
=
'Order Meal'
__version__
=
'0.1'
__flags__
=
[
'--bootstrap=sdl2'
,
'--requirements=python2,kivy'
,
'--orientation=landscape'
]
class
OrderApp
(
App
):
checkbox
=
CheckBox
()
price
=
NumericProperty
(
0.0
)
def
build
(
self
):
inspector
.
create_inspector
(
Window
,
self
)
# For inspection (press control-e to toggle).
def
add_price
(
self
):
print
(
"Hello"
)
def
bubble_tea_price
(
self
,
value
):
if
value
:
self
.
price
+=
3.75
else
:
self
.
price
-=
3.75
def
thai_tea_price
(
self
,
value
):
if
value
:
self
.
price
+=
2.75
else
:
self
.
price
-=
2.75
def
coffee_price
(
self
,
value
):
if
value
:
self
.
price
+=
2.25
else
:
self
.
price
-=
2.25
def
pho_price
(
self
,
value
):
if
value
:
self
.
price
+=
9.25
else
:
self
.
price
-=
9.25
def
stir_fry_price
(
self
,
value
):
if
value
:
self
.
price
+=
10.00
else
:
self
.
price
-=
10.00
def
fried_rice_price
(
self
,
value
):
if
value
:
self
.
price
+=
8.25
else
:
self
.
price
-=
8.25
if
__name__
==
'__main__'
:
app
=
OrderApp
()
...
...
order.kv
View file @
46c3cd1f
BoxLayout:
orientation: 'vertical'
canvas.before:
Color:
rgba: (1, 1, 1, 0)
Rectangle:
pos: self.pos
size: self.size
Label:
text: '[Your meal-ordering GUI here]'
text: 'Pho Nguyen'
font_size: '100sp'
BoxLayout:
orientation: 'horizontal'
BoxLayout:
orientation: 'vertical'
Label:
text: 'Drinks'
font_size: '30sp'
BoxLayout:
orientation: 'horizontal'
CheckBox:
id: 'check_tea'
on_active: app.thai_tea_price(self.active)
Label:
id:'thai_tea'
text_size: self.size
halign: 'left'
valign: 'middle'
font_size: '24sp'
text: 'Thai Tea'
BoxLayout:
orientation: 'horizontal'
CheckBox:
id: 'bubble_tea_check'
on_active: app.bubble_tea_price(self.active)
Label:
id:'bubble_tea'
text_size: self.size
halign: 'left'
valign: 'middle'
font_size: '24sp'
text: 'Bubble Tea'
BoxLayout:
orientation: 'horizontal'
CheckBox:
id: 'check_coffee'
on_active: app.coffee_price(self.active)
Label:
id:'coffee'
text_size: self.size
halign: 'left'
valign: 'middle'
font_size: '24sp'
text: 'Vietnamese Coffee'
BoxLayout:
orientation: 'vertical'
Label:
text: "Main Dish"
font_size: '30sp'
BoxLayout:
orientation: 'horizontal'
CheckBox:
id: 'check_pho'
on_active: app.pho_price(self.active)
Label:
id:'pho'
text_size: self.size
halign: 'left'
valign: 'middle'
font_size: '24sp'
text: 'Pho Noodles'
BoxLayout:
orientation: 'horizontal'
CheckBox:
id: 'stir_fry_check'
on_active: app.stir_fry_price(self.active)
Label:
id:'stir_fry'
text_size: self.size
halign: 'left'
valign: 'middle'
font_size: '24sp'
text: 'Stir-Fry Pho Noodles'
BoxLayout:
orientation: 'horizontal'
CheckBox:
id: 'fried_rice_check'
on_active: app.fried_rice_price(self.active)
Label:
id:'fried_rice'
text_size: self.size
halign: 'left'
valign: 'middle'
font_size: '24sp'
text: 'Fried Rice'
BoxLayout:
orientation: 'horizontal'
BoxLayout:
Label:
text: 'Price:'
font_size: '30sp'
halign: 'right'
valign: 'middle'
BoxLayout:
Label:
text: str(app.price)
font_size: '30sp'
halign: 'left'
valign: 'middle'
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