def __init__(self, name, image, radius,center, size, size2 = None): self.radius = radius self.name = name self.image = canvas.load_image(image) self.center = center self.size = size if size2 == None: self.size2 = self.size else: self.size2 = size2
def __init__(self, name, image, center, size, size2=None): self.name = name self.image = image images[name] = canvas.load_image(self.image) self.center = center self.size = size if size2 == None: self.size2 = self.size else: self.size2 = size2
ML = 60 MT = ML W = 500 partie = [ "e4","b6","d4","Bb7","Bd3","f5","exf5","Bxg2", "Qh5+", "g6","fxg6","Nf6","gxh7+","Nxh5","Bg6#" ] pieces = { 'K':(0,0),'Q':(0,1),'R':(0,2),'B':(0,3),'N':(0,4),'P':(0,5), 'k':(1,0),'q':(1,1),'r':(1,2),'b':(1,3),'n':(1,4),'p':(1,5), } echiquier = canvas.load_image("http://mrt2.no-ip.org/skulpt/assets/echiquier.gif") echiquier_size = (200,200) pions = canvas.load_image("http://mrt2.no-ip.org/skulpt/assets/pions_echecs.gif") pions_size = (60,58.5) pions_center = (30,29.25) pions_size2 = pions_size jeu = chess.Game(None,None) def render(): global jeu, count, partie, timer canvas.clear()
#canvas_test import canvas canvas.clear_timers() canvas.clear() y = 0 angle = 0 def draw(cvs): global y, angle canvas.draw_line((0,0),(500,500),4,'Red') canvas.draw_image(img,(100,100),(200,200),(160,y),(40,40),angle) y = y +0.1 angle = angle + 1 canvas.set_draw_handler(draw) canvas.start('Yellow') img = canvas.load_image("https://upload.wikimedia.org/wikipedia/commons/thumb/b/b7/Maple_Leaf_%28from_roundel%29.png/220px-Maple_Leaf_%28from_roundel%29.png")
#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()