コード例 #1
0
ファイル: pendu.py プロジェクト: mistert14/mistert-skulpt
def process():
  global errors
  
  if (errors >= 1):
    canvas.draw_line(100,400,200,400)
  if (errors >= 2):
    canvas.draw_line(100,400,200,400)  
  if (errors >= 3):
    canvas.draw_line(150,400,150,150)
  if (errors >= 4):
    canvas.draw_line(150,150,300,150)
  if (errors >= 5):
    canvas.draw_line(225,150,150,230)
  if (errors >= 6):
    canvas.draw_line(300,150,300,180)
  if (errors >= 7):
    canvas.draw_circle(300,200,20)
  if (errors >= 8):
    canvas.draw_line(300,220,300,300)
  if (errors >= 9):
    canvas.draw_line(300,300,330,360)
  if (errors >= 10):
    canvas.draw_line(300,300,270,360)
  if (errors >= 11):
    canvas.draw_line(300,240,330,300)
  if (errors >= 12):
    canvas.draw_line(300,240,270,300)
コード例 #2
0
def draw():
  
  global bits, out
  canvas.fill_rect(0,0,500,500)
  left = 80
  top = 30
  canvas.draw_line((0,30+top),(500,30+top),4,'Blue')  
  cl2 = 'Yellow'
  
  canvas.draw_text("ENTREES",(left-30,25+top),24,cl2)
  canvas.draw_text("SORTIES",(left+250,25+top),24,cl2)
  canvas.draw_circle((left, 50+top), 10, 2, 'Blue', color(str(bits['A'])))
  canvas.draw_circle((left, 73+top), 10, 2, 'Blue', color(str(bits['B'])))
  canvas.draw_circle((left, 96+top), 10, 2, 'Blue', color(str(bits['C'])))

  canvas.draw_circle((left+170, 50+top), 10, 2, 'Blue', color(out))
  
  canvas.draw_text("A: "+str(bits['A']),(left+15,58+top),24,cl2)
  canvas.draw_text("B: "+str(bits['B']),(left+15,80+top),24,cl2)
  canvas.draw_text("C: "+str(bits['C']),(left+15,102+top),24,cl2)
  canvas.draw_text(inp.get_text(),(left+185,58+top),24,cl2)
  
  """
  A FAIRE:
  
  Dessiner avec draw_circle et draw_line les interrupteurs
  et les faire basculer et eteindre quand les entrees changent
  
  """
  #dessin des fils
  canvas.draw_line((0,290+top),(100,290+top),3,'Blue')
  canvas.draw_line((150,290+top),(200,290+top),3,'Blue')
  canvas.draw_line((200,230+top),(200,350+top),3,'Blue')
  canvas.draw_line((200,230+top),(250,230+top),3,'Blue')
  canvas.draw_line((200,350+top),(250,350+top),3,'Blue')
  canvas.draw_line((300,230+top),(350,230+top),3,'Red')
  canvas.draw_line((300,350+top),(350,350+top),3,'Red')
  canvas.draw_line((350,230+top),(350,350+top),3,'Red')
  canvas.draw_line((500,290+top),(350,290+top),3,'Red') 
  canvas.draw_circle((420, 290+top), 30, 2, 'Blue', color(out))
  
  canvas.draw_text("A",(115,270+top),24,cl2)
  canvas.draw_text("B",(267,210+top),24,cl2)
  canvas.draw_text("C",(267,330+top),24,cl2)
  #dessin des interrupteurs
  
  if bits['A'] == 0:
    canvas.draw_line((100,290+top),(150,270+top),3,'Orange')
  else:
    canvas.draw_line((100,290+top),(150,290+top),3,'Orange')
  if bits['B'] == 0:
    canvas.draw_line((250,230+top),(300,230+top),3,'Orange')
  else:
    canvas.draw_line((250,230+top),(300,210+top),3,'Orange')
  if bits['C'] == 0:
    canvas.draw_line((250,350+top),(300,350+top),3,'Orange')
  else:
    canvas.draw_line((250,350+top),(300,330+top),3,'Orange')
コード例 #3
0
def draw(mycanvas):
  #ceci est la fonction qui gere l'ecran
  global bits
  left = 80
  top = 30
  canvas.draw_line((0,30+top),(500,30+top),4,'Blue')  
  cl2 = 'Yellow'
  
  canvas.draw_text("ENTREES",(left-30,25+top),24,cl2)
  canvas.draw_text("SORTIES",(left+250,25+top),24,cl2)
  canvas.draw_circle((left, 50+top), 10, 2, 'Blue', color(str(bits['A'])))
 
  canvas.draw_circle((left+250, 50+top), 10, 2, 'Blue', color(str(bits['A'])))
  
  canvas.draw_text("A: "+str(bits['A']),(left+15,58+top),24,cl2)
  canvas.draw_text("L: "+str(bits['A']),(left+265,58+top),24,cl2)
 
  canvas.draw_line((0,290+top),(100,290+top),3,'Red')
  #canvas.draw_line((150,290+top),(300,290+top),3,'Blue')
  canvas.draw_line((500,290+top),(150,290+top),3,'Blue') 
  
  canvas.draw_circle((420, 290+top), 30, 2, 'Blue', color(str(bits['A'])))
  
  canvas.draw_text("A",(115,270+top),24,cl2)
  canvas.draw_text("L",(410,240+top),24,cl2)
  
  if bits['A'] == 0:
    canvas.draw_line((100,290+top),(150,270+top),3,'Orange')
  else:
    canvas.draw_line((100,290+top),(150,290+top),3,'Orange')
  
  """
コード例 #4
0
def draw():
  #ceci est la fonction qui gere l'ecran
  global bits
  canvas.fill_rect(0,0,500,500)
  left = 80
  top = 30
  canvas.draw_line((0,30+top),(500,30+top),4,'Blue')  
  cl2 = 'Yellow'
  
  canvas.draw_text("ENTREES",(left-30,25+top),24,cl2)
  canvas.draw_text("SORTIES",(left+250,25+top),24,cl2)
  if (bits['A']+bits['B'] >= 1):
    equ = 1
  else:
    equ = 0
  canvas.draw_circle((left, 50+top), 10, 2, 'Blue', color(str(bits['A'])))
  canvas.draw_circle((left, 80+top), 10, 2, 'Blue', color(str(bits['B'])))
 
  canvas.draw_circle((left+250, 50+top), 10, 2, 'Blue', color(str(equ)))
  
  canvas.draw_text("A: "+str(bits['A']),(left+15,58+top),24,cl2)
  canvas.draw_text("B: "+str(bits['B']),(left+15,88+top),24,cl2)
  canvas.draw_text("L: "+str(equ),(left+265,58+top),24,cl2)
 
  canvas.draw_line((0,290+top),(100,290+top),3,'Red')
  canvas.draw_line((150,350+top),(200,350+top),3,'Blue')
  canvas.draw_line((50,350+top),(100,350+top),3,'Red')
  canvas.draw_line((50,350+top),(50,290+top),3,'Red')
  canvas.draw_line((200,350+top),(200,290+top),3,'Blue')
  canvas.draw_line((500,290+top),(150,290+top),3,'Blue') 
  
  canvas.draw_circle((420, 290+top), 30, 2, 'Blue', color(str(equ)))
  
  canvas.draw_text("A",(115,270+top),24,cl2)
  canvas.draw_text("B",(115,320+top),24,cl2)
  canvas.draw_text("L",(410,240+top),24,cl2)
  
  if bits['A'] == 0:
    canvas.draw_line((100,290+top),(150,270+top),3,'Orange')
  else:
    canvas.draw_line((100,290+top),(150,290+top),3,'Orange')
    
  if bits['B'] == 0:
    canvas.draw_line((100,350+top),(150,330+top),3,'Orange')
  else:
    canvas.draw_line((100,350+top),(150,350+top),3,'Orange')
  
  """
コード例 #5
0
ファイル: render.py プロジェクト: mistert14/mistert-skulpt
def render():
  global count, timer,a,b, points, lining
  canvas.clear()
  
  c = get_kb()
 
  if c == '37':
    #canvas.draw_text(250,250,"<-")
    lining = False
  if c == '39':
    #canvas.draw_text(250,250,"<-")
    lining = True
    
  ms = get_mouse()
  if len(ms) > 0:
    if not (ms in points):
      points.append(ms)
      count += 1
    for p in points:
      canvas.draw_circle(p[0],p[1],2)
  if lining:
    for i in range(len(points)-1):
      canvas.draw_line(points[i+1][0],points[i+1][1],
                       points[i][0],points[i][1])
コード例 #6
0
def draw():

    global bits, out
    canvas.fill_rect(0, 0, 500, 500)
    left = 80
    top = 30
    canvas.draw_line((0, 30 + top), (500, 30 + top), 4, "Blue")
    cl2 = "Yellow"

    canvas.draw_text("ENTREES", (left - 30, 25 + top), 24, cl2)
    canvas.draw_text("SORTIES", (left + 250, 25 + top), 24, cl2)
    canvas.draw_circle((left, 50 + top), 10, 2, "Blue", color(str(bits["A"])))
    canvas.draw_circle((left, 73 + top), 10, 2, "Blue", color(str(bits["B"])))
    canvas.draw_circle((left, 96 + top), 10, 2, "Blue", color(str(bits["C"])))

    canvas.draw_circle((left + 170, 50 + top), 10, 2, "Blue", color(out))

    canvas.draw_text("A: " + str(bits["A"]), (left + 15, 58 + top), 24, cl2)
    canvas.draw_text("B: " + str(bits["B"]), (left + 15, 80 + top), 24, cl2)
    canvas.draw_text("C: " + str(bits["C"]), (left + 15, 102 + top), 24, cl2)
    canvas.draw_text(inp.get_text(), (left + 185, 58 + top), 24, cl2)

    """
コード例 #7
0
def draw(mycanvas):
    # ceci est la fonction qui gere l'ecran
    global bits
    left = 80
    top = 30
    canvas.draw_line((0, 30 + top), (500, 30 + top), 4, "Blue")
    cl2 = "Yellow"

    canvas.draw_text("ENTREES", (left - 30, 25 + top), 24, cl2)
    canvas.draw_text("SORTIES", (left + 250, 25 + top), 24, cl2)
    canvas.draw_circle((left, 50 + top), 10, 2, "Blue", color(str(bits["A"])))
    canvas.draw_circle((left, 73 + top), 10, 2, "Blue", color(str(bits["B"])))
    canvas.draw_circle((left, 96 + top), 10, 2, "Blue", color(str(bits["C"])))

    equ = process(inp.get_text())
    canvas.draw_circle((left + 250, 50 + top), 10, 2, "Blue", color(equ))

    canvas.draw_text("A: " + str(bits["A"]), (left + 15, 58 + top), 24, cl2)
    canvas.draw_text("B: " + str(bits["B"]), (left + 15, 80 + top), 24, cl2)
    canvas.draw_text("C: " + str(bits["C"]), (left + 15, 102 + top), 24, cl2)
    canvas.draw_text(inp.get_text(), (left + 265, 58 + top), 24, cl2)

    """
コード例 #8
0
ファイル: pendu4.py プロジェクト: mistert14/mistert-skulpt
 def render(self):
 
   #global errors, mot, to_find, msg , end_game
 
   canvas.clear()
 
   if self.msg <> None:
     canvas.draw_text(200,250,self.msg)
 
   if self.end_game:
     canvas.add_button(26*18,0,18,18,"@")
   
   c = self.get_mouse()
   if c <> None:
     #une lettre est cliquee mouse_handler
     #canvas.draw_text(200,250,c)
     self.mouse_handler(c)
   
 
   w = 18
   for i in range(26):
     canvas.add_button(i*w,0,18,18,chr(65+i))
 
 
   n = len(self.mot)
   p = (500 * 2) / ( 3*n + 1 )
   e = p / 2
   
   for i in range(len(self.mot)):
     if self.mot[i] in self.to_find:
       canvas.draw_line((i+1)*e+(i)*p,80,(i+1)*(e+p),80)
     else:
       a = (i+1)*e+(i)*p
       b = (i+1)*(e+p)
       canvas.draw_text((a+b)/2 - e/2 , 70, self.mot[i])
 
 
   if (self.errors > 1):
     canvas.draw_line(100,400,200,400)
   if (self.errors >= 2):
     canvas.draw_line(100,400,200,400)  
   if (self.errors >= 3):
     canvas.draw_line(150,400,150,150)
   if (self.errors >= 4):
     canvas.draw_line(150,150,300,150)
   if (self.errors >= 5):
     canvas.draw_line(225,150,150,230)
   if (self.errors >= 6):
     canvas.draw_line(300,150,300,180)
   if (self.errors >= 7):
     canvas.draw_circle(300,200,20)
   if (self.errors >= 8):
     canvas.draw_line(300,220,300,300)
   if (self.errors >= 9):
     canvas.draw_line(300,300,330,360)
   if (self.errors >= 10):
     canvas.draw_line(300,300,270,360)
   if (self.errors >= 11):
     canvas.draw_line(300,240,330,300)
   if (self.errors >= 12):
     canvas.draw_line(300,240,270,300)