I've got a basic program going right now, with 4 buttons. Forward backward right and left. Each button goes to an image of a colored circle. Problem i'm having is that when you click a button, the picture appears. When you click another button, a different picture appears, but the first picture remains. How do I get rid of the first picture when the second button is clicked?
Additionally, I cant seem to import any pictures at all into tkinter. I get a tclerror saying that there is an error in the bitmap. Any help will be greatly appreciated. Here is a copy of my code/ import Tkinter from Tkinter import * import tkMessageBox root=Tk() frame=Frame(root) frame.pack() def forward(): forward=Tkinter.Canvas(root, bg="white", height=250, width=300) coord=10, 50, 240, 210 oval=forward.create_oval(coord, fill="blue") label=Label(root, text="This is the going forward image") label.pack forward.pack() def backward(): backward=Tkinter.Canvas(root, bg="white", height=250, width=300) coord=10, 50, 240, 210 oval=backward.create_oval(coord, fill="red") backward.pack() def left(): left=Tkinter.Canvas(root, bg="white", height=250, width=300) coord=10, 50, 240, 210 oval=left.create_oval(coord, fill="yellow") left.pack() def right(): right=Tkinter.Canvas(root, bg="white", height=250, width=300) coord=10, 50, 240, 210 oval=right.create_oval(coord, fill="green") right.pack() bottomframe=Frame(root) bottomframe.pack(side=BOTTOM) forwardbutton=Button(frame, command=forward, text="Forward", fg="blue") forwardbutton.pack(side=TOP) turnrightbutton=Button(frame, command=right, text="Turn Right", fg="blue") turnrightbutton.pack(side=RIGHT) turnleftbutton=Button(frame, command=left, text="Turn Left", fg="blue") turnleftbutton.pack(side=LEFT) backwardbutton=Button(frame, command=backward, text="Backward", fg="blue") backwardbutton.pack(side=BOTTOM) root.mainloop()
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor