Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #: import FadeTransition kivy.uix.screenmanager.FadeTransition
- #:kivy 1.9.1
- # main.py
- ScreenManagement:
- transition: FadeTransition()
- MainScreen:
- CategorySelectScreen:
- DictScreen:
- ## GŁÓWNY EKRAN
- <MainScreen>:
- name: "main"
- canvas:
- ## RYSOWANIE BIAŁEGO TŁA ##
- Color:
- rgb: (1, 1, 1)
- Rectangle:
- pos: self.pos
- size: self.size
- ## PRZYCISK START
- Button:
- background_color: (1.0, 0.0, 0.0, 1.0)
- text: "Start"
- on_release: app.root.current = "categoryscreen"
- size_hint: .2, .1
- pos_hint: {"center_x":.5, 'center_y':.5}
- ## EKRAN WYBORU KATEGORII
- <CategorySelectScreen>:
- name: "categoryscreen"
- canvas:
- ## RYSOWANIE BIAŁEGO TŁA ##
- Color:
- rgb: (1, 1, 1)
- Rectangle:
- pos: self.pos
- size: self.size
- BoxLayout:
- orientation:"vertical"
- Label:
- id: category_screen_title_label
- text:"Wybierz kategorię"
- color: 0,0,0,1
- size_hint: 1, 0.1
- font_size: sp(25)
- ## SPORT ##
- Button:
- background_color: (1.0, 0.0, 0.0, 1.0)
- text: "Sport"
- on_release:
- root.selected = "Sport"
- app.root.current = "dict"
- size_hint: None,None
- pos_hint: {"center_x":.5, 'center_y':.5}
- ## FOOD ##
- Button:
- background_color: (1.0, 0.0, 0.0, 1.0)
- text: "Food"
- on_release:
- root.selected = "Food"
- app.root.current = "dict"
- size_hint: None,None
- pos_hint: {"center_x":.5, 'center_y':.5}
- ## EKRAN SŁOWNIKA
- <DictScreen>:
- name: "dict"
- canvas:
- ## RYSOWANIE BIAŁEGO TŁA ##
- Color:
- rgb: (1, 1, 1)
- Rectangle:
- pos: self.pos
- size: self.size
- ## wybrana kategoria
- current_category:root.manager.get_screen('categoryscreen').selected
- selected_objects:root.CategorySelect(root.objects,root.current_category)
- BoxLayout: ## główny kontener
- orientation:'vertical'
- ## KATEGORIA
- Label:
- id: categoryname_label
- text:root.ChangeCategory(root.selected_objects,root.index)
- color: 0,0,0,1
- size_hint: 1, 0.2
- font_size: sp(50)
- ## OBRAZEK
- Image:
- id: item_image
- source: root.ChangeImage(root.selected_objects,root.index)
- keep_ratio: True
- allow_stretch: True
- pos_hint: {"center_x":.5}
- size_hint: 0.9, 0.8
- ## NAZWA
- Label:
- id: name_label
- text:root.ChangeLabel(root.selected_objects,root.index)
- color: 0,0,0,1
- size_hint: 1, 0.1
- font_size: sp(25)
- ## LICZNIK
- Label:
- id: counter_label
- text:"("+str(root.index+1)+"/"+str(len(root.selected_objects))+")"
- color: 0,0,0,1
- size_hint: 1, 0.1
- font_size: sp(15)
- ## DOLNY PANEL Z PRZYCISKAMI
- BoxLayout:
- size_hint: 1,0.2
- orientation:'horizontal'
- FloatLayout:
- pos_hint:{"right":1}
- ## COFNIJ DO MENU
- Button:
- id: back_button
- background_normal:'data/img/leftarrow.png'
- background_down:'data/img/leftarrow.png'
- background_color:1,0,0,1
- border: 1,1,1,1
- on_release: app.root.current = "main"
- size_hint: 0.1,.5
- BoxLayout:
- pos_hint:{"right":1}
- size_hint:0.2,.5
- orientation:'horizontal'
- ## POPRZEDNI ELEMENT
- Button:
- id: prev_button
- on_release:
- root.index=root.PrevItem(root.selected_objects,root.index)
- item_image.source=root.ChangeImage(root.selected_objects,root.index)
- name_label.text=root.ChangeLabel(root.selected_objects,root.index)
- categoryname_label.text=root.ChangeCategory(root.selected_objects,root.index)
- counter_label.text="("+str(root.index+1)+"/"+str(len(root.selected_objects))+")"
- background_normal:'data/img/leftarrow.png'
- background_down:'data/img/leftarrow.png'
- border: 1,1,1,1
- ## NASTĘPNY ELEMENT
- Button:
- id: next_button
- on_release:
- root.index=root.NextItem(root.selected_objects,root.index)
- item_image.source=root.ChangeImage(root.selected_objects,root.index)
- name_label.text=root.ChangeLabel(root.selected_objects,root.index)
- categoryname_label.text=root.ChangeCategory(root.selected_objects,root.index)
- counter_label.text="("+str(root.index+1)+"/"+str(len(root.selected_objects))+")"
- background_normal:'data/img/rightarrow.png'
- background_down:'data/img/rightarrow.png'
- border: 1,1,1,1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement