first commit

This commit is contained in:
Yura 2024-09-15 15:12:16 +03:00
commit 417e54da96
5696 changed files with 900003 additions and 0 deletions

View file

@ -0,0 +1,34 @@
'''
Referring on ids from Python
=============================
This example shows how to refer to an id from a Python file.
'''
import kivy
kivy.require('1.8.0')
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
class RootWidget(BoxLayout):
def first_function(self, status):
# print out the given parameter
print(status)
# check the status of the switch by referring on the id
if self.ids.my_switch.active is True:
# set the text of the label by referring on the id
self.ids.my_label.text = 'Switch is ON'
else:
# set the text of the label by referring on the id
self.ids.my_label.text = 'Switch is OFF'
class TestApp(App):
pass
if __name__ == '__main__':
TestApp().run()

View file

@ -0,0 +1,11 @@
#:kivy 1.8.0
RootWidget:
BoxLayout:
orientation: 'vertical'
Switch:
id: my_switch
on_active: root.first_function(self.active)
Label:
id: my_label
text: 'This text will be changed by the python file'