Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #-*-codding:utf-8*-
- from Tkinter import*
- x=250
- y=250
- def droite():
- global x,y
- x=x+10
- plateau.coords(disque,x,y)
- if x==499:
- x=0
- def gauche():
- global x,y
- x=x-10
- plateau.coords(disque,x,y)
- if x==-499:
- x=0
- def haut():
- global x,y
- y=y+10
- plateau.coords(disque,x,y)
- if y==499:
- y=0
- def bas():
- global x,y
- y=y-10
- plateau.coords(disque,x,y)
- if y==-499:
- y=0
- fen = Tk()
- plateau=Canvas(fen, width=500, height=500)
- plateau.pack()
- disque=plateau.create_oval(245,245,255,255)
- frame=Frame(fen,width=200,height=100)
- frame.pack()
- sortir=Button(frame,text="exit",command=fen.destroy)
- sortir.pack()
- bouttonh=Button(frame,text="haut",command=haut)
- bouttonh.pack()
- bouttonb=Button(frame,text="bas",command=bas)
- bouttonb.pack()
- bouttong=Button(frame,text="gauche",command=gauche)
- bouttong.pack()
- bouttond=Button(frame,text="droite",command=gauche)
- bouttond.pack()
- fen.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement