문제

I found this pie menu code for TCL/Tk here: http://wiki.tcl.tk/15400

There is a line of code I don't understand:

-command0 {bind .c <Button-1> {}; %W delete __pm; incr cnt} \

What does it mean? I think this happens: the global variable cnt is incremented. All items with the tag __pm will be removed from the canvas. This all happens if the mouse button is clicked. But this doesn't really make sense does it?

도움이 되었습니까?

해결책

It makes sense if you actually run the demo, which demonstrates pie menus with a varying number of buttons. Clicking the central "button" labelled "Ok" will delete the pie menu. Note that this central text element is item 0. %W is short-hand for the pathname of the window relating to the Tk event that fired. Incrementing the cnt (count) will cause the next pie menu to be created to have a different number of "button" elements.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top