Commit f88be241 authored by Brady James Garvin's avatar Brady James Garvin
Browse files

Added explanatory comments.

parent 566967e5
......@@ -5,7 +5,7 @@
text: 'This is the first screen.'
Button:
text: 'This button prints a number.'
on_press: root.print_number()
on_press: root.print_number() # In a custom widget's Kv, `root` refers to the custom widget.
Button:
text: 'Change…'
on_press: app.open_second_screen()
on_press: app.open_second_screen() # But `app` still refers to the application object.
......@@ -3,7 +3,7 @@ from kivy.uix.screenmanager import Screen
from kivy.properties import NumericProperty
Builder.load_file('first_screen.kv')
Builder.load_file('first_screen.kv') # Because this is not the main app Kv, we must load it explicitly.
class FirstScreen(Screen):
......
from kivy.app import App
# The following lines ensure that FirstScreen and SecondScreen are available for when the Kv code is loaded.
# Because neither PyCharm nor PyLint are aware of the associated Kv, we must disable their warnings about these widgets
# not being used.
# noinspection PyUnresolvedReferences
from first_screen import FirstScreen # pylint: disable=unused-import
# noinspection PyUnresolvedReferences
......
......@@ -4,7 +4,7 @@
Label:
text: 'This is the second screen.'
Label:
text: root.message
text: root.message # In a custom widget's Kv, `root` refers to the custom widget.
Button:
text: 'Change…'
on_press: app.open_first_screen()
on_press: app.open_first_screen() # But `app` still refers to the application object.
......@@ -3,8 +3,8 @@ from kivy.uix.screenmanager import Screen
from kivy.properties import StringProperty
Builder.load_file('second_screen.kv')
Builder.load_file('second_screen.kv') # Because this is not the main app Kv, we must load it explicitly.
class SecondScreen(Screen):
message = StringProperty('Hello, World!')
message = StringProperty('Hello, World!') # This property is changed by twoscreen.kv.
......@@ -5,4 +5,4 @@ ScreenManager:
SecondScreen:
id: second
name: 'second'
message: 'This is a message!'
message: 'This is a message!' # The app sends information to the custom widgets by setting their properties.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment