我正在尝试使用带有图标和子菜单的python添加一些shell扩展,但我很难比pywin32中的演示更进一步.我似乎无法通过搜索谷歌找到任何东西.
我相信我需要注册一个com服务器,以便能够根据右键单击文件/文件夹的位置和文件类型等更改子菜单中的选项.
# A sample context menu handler.
# Adds a 'Hello from Python' menu entry to .py files. When clicked, a
# simple message box is displayed.
#
# To demostrate:
# * Execute this script to register the context menu.
# * Open Windows Explorer, and browse to a directory with a .py file.
# * Right-Click on a .py file - locate and click on 'Hello from Python' on
# the context menu.
import pythoncom
from win32com.shell …Run Code Online (Sandbox Code Playgroud)