::tk_popup --
This procedure pops up a menu and sets things up for traversing
the menu and its submenus.
Arguments:
menu - Name of the menu to be popped up.
x, y - Root coordinates at which to pop up the menu.
entry - Index of a menu entry to center over (x,y).
If omitted or specified as {}, then menu's
upper-left corner goes at (x,y).
您将创建一个Menu实例并编写一个调用} 或^{} 方法。
它的^{
tkinter documentation当前没有关于
tk_popup()
的任何信息。请阅读Tk documentation以获取描述或源:
^{} in the Tcl/Tk source :
^{} in the Python source :
将上下文菜单调用函数与右键单击关联,通过:} 。
^{
但是,与右键单击相关联的数字在每个平台上都不相同。
^{} in the Tcl/Tk source :
下面是我编写的将上下文菜单添加到列表框的示例:
在an example on effbot中观察到
grab_release()
的使用 它对所有系统的影响可能并不相同。为了调整我的需求,我对上面的conext菜单代码做了一些修改,我想分享一下:
版本1:
版本2:
相关问题 更多 >
编程相关推荐