-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
62 lines (57 loc) · 1.77 KB
/
main.py
File metadata and controls
62 lines (57 loc) · 1.77 KB
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
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.uix.stacklayout import StackLayout
from kivy.properties import ObjectProperty, StringProperty, NumericProperty
from kivy.uix.popup import Popup
from kivy.uix.image import Image
from kivy.core.window import Window
from kivy.core.audio import SoundLoader
import os
class Controller(StackLayout):
xhint = NumericProperty(.15)
yhint = NumericProperty(.15)
letters = {}
letters['a'] = 'Avengers'
letters['b'] = 'Batman'
letters['c'] = 'Cyclops'
letters['d'] = 'Dare Devil'
letters['e'] = 'Elastic Man'
letters['f'] = 'Flash'
letters['g'] = 'Green Lantern'
letters['h'] = 'Hulk'
letters['i'] = 'Iron Man'
letters['j'] = 'Justice League'
letters['k'] = 'Kapten Amerika'
letters['l'] = 'Lucius Fox'
letters['m'] = 'Martian Manhunter'
letters['n'] = 'Nightwing'
letters['o'] = 'Owlman'
letters['p'] = 'Phantom'
letters['q'] = 'Quick Silver'
letters['r'] = 'Robin'
letters['s'] = 'Superman'
letters['t'] = 'Thor'
letters['u'] = 'Ultraman'
letters['v'] = 'Voltus 5'
letters['w'] = 'Wolverine'
letters['x'] = 'X-Men'
letters['y'] = 'Yoda'
letters['z'] = 'Zodd'
def do_pressletter(self, letter):
popup = Popup(title= self.letters[letter],
content=Image(source="img/" + letter + ".png"),
size_hint=(None, None), size=(Window.width - 20, Window.height - 50),
auto_dismiss=True)
filename = 'snd/' + letter + '.ogg'
if not os.path.exists(filename):
filename = 'snd/default.ogg'
sound = SoundLoader.load(filename)
sound.play()
popup.open()
class LetterOfHeroesApp(App):
def build(self):
return Controller()
if __name__ == '__main__':
LetterOfHeroesApp().run()