p.s.:das auskommentierte macht probleme.
niko
der code:
Code: Alles auswählen
from Tkinter import *
root = Tk()
root.title("Abakus")
cv = Canvas(root,height=450,width=650)
cv.pack()
perle = {}
usingIDLE = 0
r = 30
for x in range(10):
for y in range(10):
newp= "p"+str(x)+str(y)+" = cv.create_oval(32+"+str(x)+"*"+str(r)+"+"+str(x)+"*"+str(r)+", 32+"+str(y)+"*"+str(r)+", 32+("+str(x)+"+1)*"+str(r)+"+"+str(x)+"*"+str(r)+", 32+("+str(y)+"+1)*"+str(r)+",fill='green',outline='grey',)"
print newp
exec newp
#newb="p"+str(x)+str(y)+".bind('<Button-1>',schieb("+str(x)+","+str(y)+"))"
#print newb
#exec newb
cv.create_line(47+x*r+x*r, 2, 47+x*r+x*r, 332, width=3,)
cv.create_text(47+x*r+x*r,352,text = "0")
quit = Button(root, text="Beenden", width=6, command=root.destroy)
quit.pack(side="right")
### Aktion:Kugel nach oben schieben.
def schieb(xc,yc):
cv.coords(perle[(xc,yc)],32+xc*r+xc*r, 32+yc*r, 32+(xc+1)*r+xc*r, 32+(yc-1)*r)
root.focus_force()
if not usingIDLE:
root.mainloop()