Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Meal-Ordering App
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mgayed2
Meal-Ordering App
Commits
565284f2
Commit
565284f2
authored
4 years ago
by
mgayed2
Browse files
Options
Downloads
Patches
Plain Diff
*connected the slider with the price
*display the amount of meals *use can choose his type of food *added image
parent
7cd4824c
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
main.py
+14
-2
14 additions, 2 deletions
main.py
order.kv
+30
-1
30 additions, 1 deletion
order.kv
with
44 additions
and
3 deletions
main.py
+
14
−
2
View file @
565284f2
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
from
kivy.uix.textinput
import
TextInput
class
OrderApp
(
App
):
class
OrderApp
(
App
):
no_of_meals
=
NumericProperty
(
0
)
total
=
NumericProperty
(
0
)
amount
=
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
Amount_of_food
(
self
):
try
:
self
.
no_of_meals
=
int
(
self
.
root
.
ids
.
number_of_meals
.
text
)
except
ValueError
:
self
.
no_of_meals
=
0
def
amount_changed
(
self
):
self
.
total
=
round
(
self
.
root
.
ids
.
food
.
value
*
100
)
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
app
=
OrderApp
()
app
=
OrderApp
()
...
...
This diff is collapsed.
Click to expand it.
order.kv
+
30
−
1
View file @
565284f2
...
@@ -17,7 +17,36 @@ BoxLayout:
...
@@ -17,7 +17,36 @@ BoxLayout:
size: self.texture_size
size: self.texture_size
padding: (sp(12), 0)
padding: (sp(12), 0)
Slider:
Slider:
id: food
range: (0, 100)
range: (0, 100)
on_value: app.amount_changed()
Label:
Label:
text: f'Your total is $
0.00
'
text: f'Your total is $
{app.total /100:.2f}
'
font_size: sp(24)
font_size: sp(24)
ToggleButton:
text: 'vegan'
group: 'food_type'
ToggleButton:
text: 'meat eater'
group: 'food_type'
state: 'down'
Image:
source: 'index.jpeg'
size_hint: (1, 1)
BoxLayout:
orientation: 'horizontal'
Label:
#on_textinput: app.Amount_of_food()
text: f'How many meals? '
TextInput:
id: number_of_meals
input_filter: 'int'
Button:
text:'ok'
on_press:app.Amount_of_food()
Label:
text: f'Your number of meals= {app.no_of_meals:}'
font_size: sp(12)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment