Select Git revision
messages.php
main.py 976 B
from kivy.app import App
from kivy.uix.button import Button
from kivy.properties import NumericProperty, StringProperty
class OneTimeButton(Button):
count = 0
index = NumericProperty()
def __init__(self):
super().__init__()
self.index = OneTimeButton.count
OneTimeButton.count += 1
def on_press(self):
self.disabled = True
print(self.index)
class GuessingButton(Button):
hidden_text = StringProperty('')
def __init__(self, hidden_text):
super().__init__()
self.hidden_text = hidden_text
def on_press(self):
if self.text == '':
self.text = self.hidden_text
else:
self.text = ''
class DemoApp(App):
def build(self):
for i in range(5):
self.root.add_widget(OneTimeButton())
for i in range(5):
self.root.add_widget(GuessingButton(str(i)))
if __name__ == '__main__':
app = DemoApp()
app.run()