[Tkinter-discuss] Kinetic Scrolling and Keyboard Shortcuts in Menus

Johnston Jiaa oclbdk at gmail.com
Sun Aug 31 06:11:12 CEST 2008

I'm having trouble trying to make a kinetic scrolling canvas.  The  
code looks something like this...

def scroll(acceleration, speed):
	while speed >= 0:
		canvas.xview_scroll(-speed, "units")
		speed -= acceleration

This doesn't update the drawing of the canvas in real-time (as in,  
every time xview_scroll is called)... it only updates the drawing  
after the while loop has already run, so you don't get to see it  
scroll, which is stupid.  How can I get this to work properly?

Also, I have set keyboard shortcuts for some functions in my program.   
The functions these shortcuts call are also linked to menu items in  
the menu bar.  How can I get the menu labels to reflect the keyboard  
shortcuts for each relative command?  I know I can set the shortcut as  
a string in the label manually, but it will be stupid, not flush with  
the right edge of the menu, like in other programs.

Thanks for helping my program not be stupid

More information about the Tkinter-discuss mailing list