# (list) Application requirements
# comma separated e.g. requirements = sqlite3,kivy
#!/usr/bin/python
import kivy
from kivy.app import App
from kivy.uix.textinput import TextInput
from kivy.uix.gridlayout import GridLayout
from kivy.uix.button import Button
class RootWidget(GridLayout):
def __init__(self, **kwargs):
super(RootWidget, self).__init__(**kwargs)
self.cols = 2
self.add_widget(CreateInput(multiline=False))
class CreateInput(TextInput):
def on_text_validate(self):
for i in range(int(self.text)):
self.parent.add_widget(Button(text=str(i)))
class MyApp(App):
def build(self):
return RootWidget()
if __name__ == "__main__":
MyApp().run()
from kivy.uix.button import Button
from kivy.core.window import Window
class HLButton(Button):
def __init__(self, *args, **kwargs):
super(HLButton, self).__init__(*args, **kwargs)
Window.bind(mouse_pos=self.pos_check)
def pos_check(self, inst, pos):
if self.collide_point(*pos):
self.background_color = (1, 0, 0, 1)
else:
self.background_color = (.52, .43, .57, 1)