Dear tkinter peoples, I'm having difficulties with dash, and dashoffset; Can anyone identify what I'm doing wrong?
- Code: ---------------------------------------------------- import tkinter def move_dashes(canvas, rect, offset): print("move_dashes(%s, %s, %s)" % (canvas, rect, offset)) canvas.itemconfigure(rect, dashoffset=offset) canvas.after(1000, move_dashes, canvas, rect, offset+1) def dashoffset_test(): # Create a canvas canvas = tkinter.Canvas() canvas.pack() # Put a comparison rectangle on the canvas. canvas.create_rectangle(7, 2, 27,28, outline="blue", dash=(5,1)) # Put a rectangle on the canvas with a moving dash pattern. rect = canvas.create_rectangle(10,5, 30,30, dash=(4,1)) canvas.after(1000, move_dashes, canvas, rect, 1) canvas.mainloop() dashoffset_test() ============================================================ Two questions: 1. Why are the dash patterns so wildly different? canvas.create_rectangle(7, 2, 27,28, outline="blue", dash=(5,1)) canvas.create_rectangle(10,5, 30,30, dash=(4,1)) The first looks like: xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxxx The second looks like: xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx ...and yet, it's just (5,1) vs. (4,1) This is not what I expect from: http://infohost.nmt.edu/tcc/help/pubs/tkinter/dash-patterns.html 2. Why doesn't the dash pattern move? The call to canvas.itemconfigure(rect, dashoffset=offset) looks correct; Am I doing it wrong? I am using Python 3.1 Thank you, Lion Kimbro
_______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org http://mail.python.org/mailman/listinfo/tkinter-discuss