Python 如何在 Spyder 中显示函数参数?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25982798/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-18 23:54:54  来源:igfitidea点击:

How to display function arguments in Spyder?

pythonuser-interfaceeditorspyder

提问by Erik van Elten

I'm using Spyder 2.2.5 with Python 2.7 and I want the editor to display the arguments of the function I'm calling after I type the first parenthesis. I know it's possible, because I can see it in the video-tutorials I'm using. I've tried (at least I think so..) all menu-items. Getting crazy here, please help!

我将 Spyder 2.2.5 与 Python 2.7 一起使用,并且我希望编辑器在我输入第一个括号后显示我正在调用的函数的参数。我知道这是可能的,因为我可以在我正在使用的视频教程中看到它。我已经尝试过(至少我这么认为......)所有菜单项。在这里发疯,请帮忙!

回答by Fahad Sarfraz

You can activate the object inspectorto display the documention of the function itself by enabling automatic connections for your editor or console. It will then show you the function parameters as you press the left parenthesis.

您可以通过为编辑器或控制台启用自动连接来激活对象检查器以显示功能本身的文档。然后,当您按左括号时,它将显示函数参数。

To enable it go to Tools > Preferences > Object Inspector . Under Help-> Automatic connections check your desired programming environment and enable plug-in.

要启用它,请转到 Tools > Preferences > Object Inspector 。在帮助-> 自动连接下检查您想要的编程环境并启用插件。

回答by Andrzej Gis

I have a similar problem. The arguments pop-up shows up only until I start typing, so I have a problem if I forget what the latter arguments are. A workaround is to move the cursor on the function and press Ctrl+ i. It shows the function documentation in help window, including its definition.

我有一个类似的问题。参数弹出窗口只在我开始输入之前显示,所以如果我忘记了后面的参数是什么,我就会遇到问题。解决方法是将光标移动到函数上并按Ctrl+ i。它在帮助窗口中显示功能文档,包括其定义。

回答by Teoman Yüksel

For Spyder 3:

对于 Spyder 3:

Tools > Preferences > Help > Automatic Connectionsand then tick all the workspaces you want it to show functions' arguments.

工具 > 首选项 > 帮助 > 自动连接,然后勾选您希望它显示函数参数的所有工作区。

回答by A.raoof Hujairi

often would need to restart Spyder to have the inline help

通常需要重新启动 Spyder 才能获得内联帮助

回答by Carlo Carandang

Go to View > Window layouts > Spyder Default Layout. This resets the Spyder IDE to the defaults, and the object inspector will function again (worked for me).

转到“视图”>“窗口布局”>“Spyder 默认布局”。这会将 Spyder IDE 重置为默认值,并且对象检查器将再次运行(对我有用)。