first commit
This commit is contained in:
commit
417e54da96
5696 changed files with 900003 additions and 0 deletions
Binary file not shown.
28
kivy_venv/share/kivy-examples/container/kv/1.kv
Normal file
28
kivy_venv/share/kivy-examples/container/kv/1.kv
Normal file
|
@ -0,0 +1,28 @@
|
|||
#:kivy 1.8.0
|
||||
#:import datetime datetime
|
||||
|
||||
RootWidget:
|
||||
# import container
|
||||
container: container
|
||||
|
||||
# fill the container
|
||||
BoxLayout:
|
||||
id: container
|
||||
orientation: 'vertical'
|
||||
padding: 0
|
||||
spacing: 3
|
||||
|
||||
Label:
|
||||
text: 'screen-1'
|
||||
|
||||
BoxLayout:
|
||||
orientation: 'horizontal'
|
||||
padding: 0
|
||||
spacing: 1
|
||||
size_hint: 1, 0.1
|
||||
|
||||
# weiter button
|
||||
Button:
|
||||
size_hint: 0.2, 1
|
||||
text: 'next'
|
||||
on_release: app.next_screen('2')
|
28
kivy_venv/share/kivy-examples/container/kv/2.kv
Normal file
28
kivy_venv/share/kivy-examples/container/kv/2.kv
Normal file
|
@ -0,0 +1,28 @@
|
|||
#:kivy 1.8.0
|
||||
#:import datetime datetime
|
||||
|
||||
RootWidget:
|
||||
# import container
|
||||
container: container
|
||||
|
||||
# fill the container
|
||||
BoxLayout:
|
||||
id: container
|
||||
orientation: 'vertical'
|
||||
padding: 0
|
||||
spacing: 3
|
||||
|
||||
Label:
|
||||
text: 'screen-2'
|
||||
|
||||
BoxLayout:
|
||||
orientation: 'horizontal'
|
||||
padding: 0
|
||||
spacing: 1
|
||||
size_hint: 1, 0.1
|
||||
|
||||
# weiter button
|
||||
Button:
|
||||
size_hint: 0.2, 1
|
||||
text: 'next'
|
||||
on_release: app.next_screen('3')
|
28
kivy_venv/share/kivy-examples/container/kv/3.kv
Normal file
28
kivy_venv/share/kivy-examples/container/kv/3.kv
Normal file
|
@ -0,0 +1,28 @@
|
|||
#:kivy 1.8.0
|
||||
#:import datetime datetime
|
||||
|
||||
RootWidget:
|
||||
# import container
|
||||
container: container
|
||||
|
||||
# fill the container
|
||||
BoxLayout:
|
||||
id: container
|
||||
orientation: 'vertical'
|
||||
padding: 0
|
||||
spacing: 3
|
||||
|
||||
Label:
|
||||
text: 'screen-3'
|
||||
|
||||
BoxLayout:
|
||||
orientation: 'horizontal'
|
||||
padding: 0
|
||||
spacing: 1
|
||||
size_hint: 1, 0.1
|
||||
|
||||
# weiter button
|
||||
Button:
|
||||
size_hint: 0.2, 1
|
||||
text: 'next'
|
||||
on_release: app.next_screen('1')
|
32
kivy_venv/share/kivy-examples/container/kv/root.kv
Normal file
32
kivy_venv/share/kivy-examples/container/kv/root.kv
Normal file
|
@ -0,0 +1,32 @@
|
|||
#:kivy 1.8.0
|
||||
|
||||
RootWidget:
|
||||
# import container
|
||||
container: container
|
||||
|
||||
BoxLayout:
|
||||
orientation: 'vertical'
|
||||
padding: 0
|
||||
spacing: 6
|
||||
|
||||
# bottom-left part:
|
||||
BoxLayout:
|
||||
orientation: 'horizontal'
|
||||
padding: 0
|
||||
spacing: 6
|
||||
|
||||
# bottom-left
|
||||
BoxLayout:
|
||||
size_hint: 0.12, 0.12
|
||||
orientation: 'vertical'
|
||||
padding: 0
|
||||
spacing: 6
|
||||
|
||||
# option calibrate
|
||||
Button:
|
||||
text: 'Start'
|
||||
on_release: app.next_screen('1')
|
||||
|
||||
# create container (bottom-right)
|
||||
BoxLayout:
|
||||
id: container
|
63
kivy_venv/share/kivy-examples/container/main.py
Normal file
63
kivy_venv/share/kivy-examples/container/main.py
Normal file
|
@ -0,0 +1,63 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
'''
|
||||
Container Example
|
||||
==============
|
||||
|
||||
This example shows how to add a container to our screen.
|
||||
A container is simply an empty place on the screen which
|
||||
could be filled with any other content from a .kv file.
|
||||
'''
|
||||
from kivy.app import App
|
||||
from kivy.lang import Builder
|
||||
from kivy.uix.boxlayout import BoxLayout
|
||||
from kivy.properties import ObjectProperty
|
||||
|
||||
import kivy
|
||||
kivy.require('1.8.0')
|
||||
|
||||
|
||||
class RootWidget(BoxLayout):
|
||||
'''Create a controller that receives a custom widget from the kv lang file.
|
||||
Add an action to be called from a kv file.
|
||||
'''
|
||||
|
||||
container = ObjectProperty(None)
|
||||
|
||||
|
||||
class EzsApp(App):
|
||||
|
||||
'''This is the app itself'''
|
||||
|
||||
def build(self):
|
||||
'''This method loads the root.kv file automatically
|
||||
|
||||
:rtype: none
|
||||
'''
|
||||
# loading the content of root.kv
|
||||
self.root = Builder.load_file('kv/root.kv')
|
||||
|
||||
def next_screen(self, screen):
|
||||
'''Clear container and load the given screen object from file in kv
|
||||
folder.
|
||||
|
||||
:param screen: name of the screen object made from the loaded .kv file
|
||||
:type screen: str
|
||||
:rtype: none
|
||||
'''
|
||||
|
||||
filename = screen + '.kv'
|
||||
# unload the content of the .kv file
|
||||
# reason: it could have data from previous calls
|
||||
Builder.unload_file('kv/' + filename)
|
||||
# clear the container
|
||||
self.root.container.clear_widgets()
|
||||
# load the content of the .kv file
|
||||
screen = Builder.load_file('kv/' + filename)
|
||||
# add the content of the .kv file to the container
|
||||
self.root.container.add_widget(screen)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
'''Start the application'''
|
||||
|
||||
EzsApp().run()
|
Loading…
Add table
Add a link
Reference in a new issue