def new_game(self): canvas.clear_timers() self.t.stop() self.t.start() self.t2.stop() self.t2.start()
def new_game(self): #global mot, to_find, letters, to_find, msg, errors, end_game, t canvas.clear_timers() f = urllib2.urlopen(URL) mots = f.readlines() mots.pop(-1) self.mot = ''.join(str(x) for x in mots) self.to_find = [] self.letters = [] for c in self.mot: if not(c in self.to_find): self.to_find.append(c) self.msg = None self.errors = 1 self.end_game = False self.t.stop() self.t.start()
import canvas, math, math2 canvas.clear_timers() #variables generales sound = canvas.load_sound("http://s1download-universal-soundbank.com/mp3/sounds/12733.mp3") bits = {'A': 0, 'B': 0, 'C': 0 } out = '0' #fonction de calcul de la sortie def process(val): global bits, out parser = math2.RpnMathParser(val, bits); out = parser.get_result() if str(out) == '0.0': out = '0' sound.pause() sound.rewind() else: out = '1' sound.play() #gestion des cases a cocher def chk(id,value): global bits if value: bits[id] = 1 else: bits[id] = 0 process(inp.get_text()) #gestion de l'equation def check(val): process(val) #creation de l'interface