Skip to content
Snippets Groups Projects
Commit 0626ee12 authored by [sabdelmoaty2]'s avatar [sabdelmoaty2]
Browse files

Make ToggleButton and ProgressBar for displaying.

parent 7cd4824c
Branches master
No related tags found
No related merge requests found
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()
......
......@@ -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'Your total is $0.00'
text:f'your 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment