-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
175 lines (129 loc) · 4.52 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
from kivy.app import App
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.lang import Builder
from kivy.uix.image import Image
from kivy.uix.behaviors import ButtonBehavior
from kivy.uix.widget import Widget
from kivy.graphics import Color, Ellipse, Line
from kivy.core.audio import SoundLoader
from kivy.core.window import Window
from random import random
Window.clearcolor = 1, 1, 1, 1
Window.icon = 'media/numbers/toys-icon.png'
class NumerosWindow(Screen):
def contar(self):
clicks = int(self.ids['contar_btn'].text)
if clicks == 10:
clicks = 0
self.ids['contar_btn'].text = str(clicks + 1)
return self.ids['contar_btn']
def num_btn_txt(self):
num_btn = self.ids['contar_btn']
number = 1
num_btn.text = str(number)
return num_btn.text
def set_numeros_image(self):
clicks = int(self.ids['contar_btn'].text)-1
images = ['media/numbers/01.jpg',
'media/numbers/02.jpg',
'media/numbers/03.jpg',
'media/numbers/04.jpg',
'media/numbers/05.jpg',
'media/numbers/06.jpg',
'media/numbers/07.jpg',
'media/numbers/08.jpg',
'media/numbers/09.jpg',
'media/numbers/10.jpg']
display_image = self.ids.num_image
for image in images:
image = images[clicks]
display_image.source = image
return image
class ImageButton(ButtonBehavior, Image):
pass
class ColoresWindow(Screen):
def audio_violeta(self):
sound = SoundLoader.load('media/audio/colores_violeta.wav')
sound.play()
def audio_amarillo(self):
sound = SoundLoader.load('media/audio/colores_amarillo.wav')
sound.play()
def audio_verde(self):
sound = SoundLoader.load('media/audio/colores_verde.wav')
sound.play()
def audio_azul(self):
sound = SoundLoader.load('media/audio/colores_azul.wav')
sound.play()
def audio_marron(self):
sound = SoundLoader.load('media/audio/colores_marron.wav')
sound.play()
def audio_naranja(self):
sound = SoundLoader.load('media/audio/colores_naranja.wav')
sound.play()
def audio_rosa(self):
sound = SoundLoader.load('media/audio/colores_rosa.wav')
sound.play()
def audio_rojo(self):
sound = SoundLoader.load('media/audio/colores_rojo.wav')
sound.play()
class AnimalesWindow(Screen):
def audio_oso(self):
sound = SoundLoader.load('media/audio/bear.wav')
sound.play()
def audio_cerdo(self):
sound = SoundLoader.load('media/audio/pig_oink.wav')
sound.play()
def audio_pato(self):
sound = SoundLoader.load('media/audio/duck.wav')
sound.play()
def audio_lobo(self):
sound = SoundLoader.load('media/audio/wolf_howl.wav')
sound.play()
def audio_elefante(self, *args):
sound = SoundLoader.load('media/audio/elephant.wav')
sound.play()
def audio_gato(self):
sound = SoundLoader.load('media/audio/cat_meow.wav')
sound.play()
def audio_leon(self):
sound = SoundLoader.load('media/audio/lion_roar.wav')
sound.play()
def audio_mono(self):
sound = SoundLoader.load('media/audio/monkey_excited.wav')
sound.play()
def audio_gallo(self):
sound = SoundLoader.load('media/audio/rooster.wav')
sound.play()
def audio_vaca(self):
sound = SoundLoader.load('media/audio/cow_moo.wav')
sound.play()
def audio_rana(self):
sound = SoundLoader.load('media/audio/frog.wav')
sound.play()
def audio_perro(self):
sound = SoundLoader.load('media/audio/dog_bark.wav')
sound.play()
class MainWindow(Screen):
pass
class WindowManager(ScreenManager):
pass
class PaintWindow(Screen):
pass
class PaintWidget(Widget):
def on_touch_down(self, touch):
color = (random(), random(), random())
with self.canvas:
Color(*color)
d = 10.
Ellipse(pos=(touch.x - d / 2, touch.y - d / 2), size=(d, d))
touch.ud['line'] = Line(points=(touch.x, touch.y), width=1.5)
def on_touch_move(self, touch):
touch.ud['line'].points += [touch.x, touch.y]
def clear_canvas(self):
self.canvas.clear()
kv = Builder.load_file("Babies.kv")
class BabiesApp(App):
def build(self):
return kv
if __name__ == '__main__':
BabiesApp().run()