0
I am a beginner in python and I want that whenever a certain button is pressed, run a function. Here is the code:
application py.
import kivy
kivy.require("1.8.0")
from kivy.app import App
class application(App):
def printar(self):
print("Hello World")
application().run()
application.Kv
BoxLayout:
orientation: "vertical"
BoxLayout:
spacing: 130
padding: [30, 30, 30, 30]
size_hint: [1, .1]
orientation: "horizontal"
Button:
id: option
text: "Options"
Label:
text: "Connected"
bold: True
color: [0, 1, 0, .8]
font_name: "DejaVuSans"
Button:
id: onoff
text: "On/Off"
BoxLayout:
orientation: "horizontal"
spacing: 20
padding: [30, 30, 30, 30]
TextInput:
size_hint: [.7, .05]
pos_hint: {"y": .5}
multiline: False
hint_text: "Write"
Button:
id: send
text: "Send"
size_hint: [.2, .05]
pos_hint: {"y": .5}
on_release: root.printar()