def new function generate question.
[tibetan_culture:learn_tibetan.git] / main.py
1 from random import shuffle
2 from unicodedata import lookup
3 from Tkinter import *
4 from pygame import mixer
5
6 letras = {lookup("tibetan letter ka"):("ka", "sound/ka.mp3"), 
7           lookup("tibetan letter kha"):("k'a", "sound/kha.mp3"),
8           lookup("tibetan letter ga"):("k'a", "sound/kh_a.mp3"),
9           lookup("tibetan letter nga"):("nga", "sound/nga.mp3")}
10
11 def generate_question(list_questions):
12     shuffle(list_questions)
13     right_answer = list_questions[0]
14     wrong_answers = [list_questions[1],list_questions[2],
15                      list_questions[3]]
16     return right_answer, wrong_answers
17
18 def play_ogg():
19     mixer.init()
20     mixer.music.load('Example.ogg')
21     mixer.music.play()
22     
23 #print letras["ka"][0] # letra tibetana (importante poner el print)
24 #letras["ka"][1] # fichero de sonido
25
26 ventana = Tk()
27 ventana.geometry("650x560+100+80")
28 label = Label(ventana, text = letras['ka'][0], font=("", 80))
29 label.pack()
30 #play_sound=Button(ventana,width=50,height=50,fg='black',
31 #            bitmap='snackPlay', command=play_ogg).place(x=115,y=501)
32 option_1 = Button(ventana,width=50,height=50,fg='red', 
33                   bitmap='snackRecord').place(x=5,y=501) 
34 option_2 = Button(ventana,width=50,height=50,fg='black', 
35             bitmap='snackStop').place(x=60,y=501) 
36 option_3 = Button(ventana,width=50,height=50,fg='black', 
37                 bitmap='snackPlay', command=play_ogg).place(x=115,y=501) 
38 option_4 = Button(ventana,width=5,height=3,fg='black', 
39                 text='Save').place(x=170,y=501) 
40 ventana.mainloop()