Skip to content
Snippets Groups Projects
Commit 8c7eb0c1 authored by Brady James Garvin's avatar Brady James Garvin
Browse files

Initial commit.

parents
No related branches found
No related tags found
No related merge requests found
.idea
*.pyc
*.pyo
*.apk
<FirstScreen>:
BoxLayout:
orientation: 'vertical'
Label:
text: 'This is the first screen.'
Button:
text: 'This button prints a number.'
on_press: root.print_number()
Button:
text: 'Change…'
on_press: app.open_second_screen()
from kivy.lang import Builder
from kivy.uix.screenmanager import Screen
from kivy.properties import NumericProperty
Builder.load_file('first_screen.kv')
class FirstScreen(Screen):
number = NumericProperty(0)
def print_number(self):
print(self.number)
self.number += 1
main.py 0 → 100644
from kivy.app import App
# noinspection PyUnresolvedReferences
from first_screen import FirstScreen
# noinspection PyUnresolvedReferences
from second_screen import SecondScreen
__app_package__ = 'edu.unl.cse.soft161.two_screen'
__app__ = 'Two-Screen App'
__version__ = '1.0'
__flags__ = ['--bootstrap=sdl2', '--requirements=python2,kivy', '--orientation=landscape']
class TwoScreenApp(App):
def open_first_screen(self):
self.root.transition.direction = 'right'
self.root.current = 'first'
def open_second_screen(self):
self.root.transition.direction = 'left'
self.root.current = 'second'
if __name__ == '__main__':
app = TwoScreenApp()
app.run()
<SecondScreen>:
BoxLayout:
orientation: 'vertical'
Label:
text: 'This is the second screen.'
Label:
text: root.message
Button:
text: 'Change…'
on_press: app.open_first_screen()
from kivy.lang import Builder
from kivy.uix.screenmanager import Screen
from kivy.properties import StringProperty
Builder.load_file('second_screen.kv')
class SecondScreen(Screen):
message = StringProperty('Hello, World!')
ScreenManager:
FirstScreen:
name: 'first'
id: first
SecondScreen:
id: second
name: 'second'
message: 'This is a message!'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment