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
sabdelmoaty2
Meal-Ordering App
Commits
0626ee12
Commit
0626ee12
authored
4 years ago
by
[sabdelmoaty2]
Browse files
Options
Downloads
Patches
Plain Diff
Make ToggleButton and ProgressBar for displaying.
parent
7cd4824c
Branches
master
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
main.py
+24
-1
24 additions, 1 deletion
main.py
order.kv
+21
-1
21 additions, 1 deletion
order.kv
with
45 additions
and
2 deletions
main.py
+
24
−
1
View file @
0626ee12
from
kivy.app
import
App
from
kivy.modules
import
inspector
# For inspection.
from
kivy.core.window
import
Window
# For inspection.
from
kivy.modules
import
inspector
# For inspection.
from
kivy.properties
import
NumericProperty
from
kivy.properties
import
BooleanProperty
from
kivy.uix.progressbar
import
ProgressBar
class
OrderApp
(
App
):
total
=
NumericProperty
(
0
)
# In cents.
amount_of_meals
=
NumericProperty
(
0
)
H_food
=
BooleanProperty
(
False
)
num_of_ppl
=
NumericProperty
(
0
)
def
build
(
self
):
inspector
.
create_inspector
(
Window
,
self
)
# For inspection (press control-e to toggle).
def
Num_of_ppl
(
self
,
group
):
if
group
:
print
(
f
'
{
self
.
amount_of_meals
/
group
}
'
)
else
:
print
(
f
"
No meals
"
)
def
food_sorting
(
self
,
Home_food
):
self
.
H_food
=
Home_food
def
amount_changed
(
self
):
self
.
total
=
round
(
self
.
root
.
ids
.
food
.
value
*
100
)
print
()
if
__name__
==
'
__main__
'
:
app
=
OrderApp
()
...
...
This diff is collapsed.
Click to expand it.
order.kv
+
21
−
1
View file @
0626ee12
...
...
@@ -17,7 +17,27 @@ BoxLayout:
size: self.texture_size
padding: (sp(12), 0)
Slider:
id: food
range: (0, 100)
on_value: app.amount_changed()
Label:
text:
f'
Y
our total is $
0.00
'
text:f'
y
our total is $
{app.total / 100:.2f}
'
font_size: sp(24)
ToggleButton:
text: 'Home food'
group: 'Food_sorting'
state: 'down'
on_release: app.food_sorting(True)
ToggleButton:
text: 'Fast food'
group: 'Food_sorting'
on_release: app.food_sorting(False)
ProgressBar:
max: 1000
value: 750
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