本文介绍了如何添加“新”上下文菜单的Python脚本选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我正在尝试为Windows 7上的新建-> Python脚本添加上下文菜单选项。但是,我尝试过的所有操作都失败了。 我认为应该可以使用的功能如下: 添加以下注册表项: [HKEY_CLASSES_ROOT\.py\ShellNew] FileName = Template.py 空文件版本: [HKEY_CLASSES_ROOT\.py\ShellNew] NullFile = 可选的注册表项 [HKEY_CLASSES_ROOT\.py] PerceivedType =文本/纯文本 @ = Python脚本 将文件添加到Windows ShellNew文件夹... 中的Python模板文件 此什么也没做,尽管我之前已经做过,并且可以与其他文件类型一起使用。我无法在任何地方找到任何东西,因为它们可以为我尝试其他文件类型的所有工作。 我在做什么错了? 编辑:Python 2.7.8或更高版本在安装/安装过程中添加了此选项。 参考: MSDN扩展快捷菜单 解决方案 HKEY_CLASSES_ROOT\.py\PerceivedType = text HKEY_CLASSES_ROOT\ \.py\ShellNew\NullFile = 在Windows 7上为我工作。 p> 我也将 HKEY_CLASSES_ROOT\Python 的默认值设置为 Python脚本 Windows注册表编辑器版本5.00 [HKEY_CLASSES_ROOT\.py] @ = Python 内容类型 = text / x-python P ython = Python PerceivedType =文本 [HKEY_CLASSES_ROOT\.py\ShellNew] NullFile = [HKEY_CLASSES_ROOT\Python] @ = Python脚本 I'm trying to add a context menu option for New -> Python Script on Windows 7. However, everything I've tried has failed.The way that I thought it should work is below:Add the following registry key:[HKEY_CLASSES_ROOT\.py\ShellNew]"FileName"="Template.py"Null File version:[HKEY_CLASSES_ROOT\.py\ShellNew]"NullFile"=""Optional registry key[HKEY_CLASSES_ROOT\.py]"PerceivedType"="text/plain"@="Python Script"Add the file to the Windows, ShellNew folder...This does nothing, although I've done this before, and it worked with other file types. I'm unable to find anything for this anywhere, because they do everything I try for other file types.What am I doing wrong?EDIT: Python 2.7.8 or later has this option added during setup/installation.Reference: MSDN Extending Shortcut Menus 解决方案 HKEY_CLASSES_ROOT\.py\PerceivedType="text"together withHKEY_CLASSES_ROOT\.py\ShellNew\NullFile=""works for me on Windows 7.I have also set HKEY_CLASSES_ROOT\Python default value to "Python Script"Windows Registry Editor Version 5.00[HKEY_CLASSES_ROOT\.py]@="Python""Content Type"="text/x-python""Python"="Python""PerceivedType"="text"[HKEY_CLASSES_ROOT\.py\ShellNew]"NullFile"=""[HKEY_CLASSES_ROOT\Python]@="Python Script" 这篇关于如何添加“新”上下文菜单的Python脚本选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
05-27 01:31
查看更多