bymyside_ 发表于 2022-7-5 17:48:38

python tkinter弹出菜单部分方法问题

from tkinter import *
window = Tk()
menu = Menu()


def callbakc(event):
    menu.post(event.x_root, event.y_root)

for item in ['文件', '编辑', '视图', '格式']:
    menu.add_command(label=item)

window.bind('<Button-3>', callbakc)

window.mainloop()

遇到的问题1:
F:\Anaconda\AnacondaApp\lib\site-packages\numpy\__init__.py:148: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
from . import _distributor_init
问题2:
event.x_root和event.y_root的含义?
谢谢各位了!!!

bymyside_ 发表于 2022-7-5 21:13:09

已解决
页: [1]
查看完整版本: python tkinter弹出菜单部分方法问题