1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- #!/usr/bin/env python3
- # -*- coding: utf-8 -*-
- """
- Created on Thu Jan 30 18:15:12 2019
- @author: moetom
- """
- import mod.switch
- gemList = [] # Gemueseliste
- class Gemuese:
-
- def __init__ (self, art):
- self.art = str(art)
- self.vocab = [] # Vocabular / sounds
- self.vocabStr = [] # Vocabular / strings
- self.variation = 0 # variation file in current mode
- self.sleepTime = 0
- gemList.append(self)
-
- def AddVocab (self, sound, text):
- """ adds the sounds and texts into lists """
- self.vocab.append(sound)
- self.vocabStr.append(text)
-
- def ResetVariation(self, activMode):
- """ reset variation and play again """
- self.variation = 0
- self.Play(activMode)
-
- def Play(self, activMode):
- """ plays sound and print text from lists """
- if mod.switch.modeList[activMode] != mod.switch.drums: # no len(self.vocab[mode][self.variation]) possible for drums
- if self.variation < len(self.vocab[mod.switch.activMode]): # check if variation is not out of range
- self.vocab[activMode][self.variation].play()
- print("["+self.art+"]\n{}\n".format(self.vocabStr[activMode][self.variation]))
- self.sleepTime = self.vocab[mod.switch.activMode][self.variation].get_length()
- self.variation = self.variation + 1
- else:
- self.ResetVariation(activMode)
- else: # drum mode has no variation
- self.vocab[activMode].play()
- print("["+self.art+"] - {}".format(self.vocabStr[activMode]))
-
- tomate = Gemuese ("Tomate")
- apfel = Gemuese ("Apfel")
- paprika = Gemuese ("Paprika")
- orange = Gemuese ("Orange")
- zitrone = Gemuese ("Zitorne")
- kartoffel = Gemuese ("Kartoffel")
|