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
Example #2
0
#cards
import canvas
import games
import document

play = document.getElementById('chk').checked
if play == 'True':
  music = canvas.load_sound("http://mrt2.no-ip.org/skulpt/assets/Epoq-Lepidoptera.ogg")
  music.play()

canvas.clear()


image = canvas.load_image("http://mrt2.no-ip.org/skulpt/assets/cards.jfitz.png")

card_size = (73, 98)
card_center = (0, 0)

desk = games.Deck()

def tick():
  global desk, image, card_size, card_center
  for i in range(6):
    carte = desk.give_card()
    canvas.draw_image(image, (card_size[0]*carte[0],card_size[1]*carte[1]), card_size, (74*i,0), card_size )

timer = canvas.create_timer(1000, tick)
timer.start()