蟒蛇空闲.自动完成/显示完成不起作用 [英] Python IDLE. Auto-complete/Show completions not working

查看:33
本文介绍了蟒蛇空闲.自动完成/显示完成不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

IDLE 对于何时实际显示自动完成菜单非常狡猾.最近它根本没有工作,或者更具体地说,只在交互式会话期间工作.

IDLE is being very dodgy as to when it will actually show an Auto-complete menu. As of late it hasn't been working at all, or, more specifically, only works during an interactive session.

我一直在使用 C 的代码块,并且已经非常习惯了非常好的自动完成功能,所以没有它们有点令人沮丧——尤其是在尝试学习一个新的框架和类是什么时与哪些方法等相关联.

I've been using Code Blocks for C, and have gotten really used to the very nice auto-complete features, so it's a bit frustrating not having them -- especially while trying to learn a new frame work and what class is associated with which methods, etc, etc..

是否有一个简单的修复方法可以让 IDLE 自动完成功能再次运行?我正在使用 python 2.7 版.

Is there an easy fix to get IDLE auto-complete working again? I'm using python version 2.7.

也许我应该研究一个简单的编辑器?我试过 Vim,它对于我的简单需求来说有点太重了,Ninja,我无法为任何东西工作,以及 Sublime text 2,我无法让我的 wxpython 东西玩.什么是不错的选择?任何类似于代码块的东西都会很酷,不过,如果 IDLE 一直有效,我会非常满意!

Is there perhaps a simple editor I should look into? I've tried Vim, which was a little too heavy for my simple needs, Ninja, which I couldn't get to work for anything, and Sublime text 2, which I couldn't get my wxpython stuff to play with. What would a nice option be? Anything similar to Code Blocks would be cool, although, I'd be perfectly happy with IDLE if it would consistently work!

要求澄清:好吧,看来我的一些术语可能倒退了.非交互式,我的意思是,例如,右键单击 python 文件并选择使用空闲编辑".这带来了我猜可以被描述为文本编辑器的东西.您可以在此处输入所有代码.准备好后,然后按 F5,或选择运行,它会启动(我一直指的是)交互式终端.您可以在此处输入代码,按回车键,然后立即评估该代码.

REQUESTED CLARIFICATION: OK, so it seems I may have some of my terminology backwards. By non-interactive, I mean, for instance, right clicking on a python file and selecting "edit with IDLE". This brings up what I guess could be described as a text editor. You can enter all you code here. Once ready, you then hit F5, or select Run, and it launches (what I've been referring to as) the interactive terminal. It's here that you can type in code, press return, and instantly have that code evaluated.

我的问题指的是前者,即您编辑代码的 IDLE 部分.有时在打字时,在 .它将显示可用的方法,或者在一个左括号后给出预期值的提示.但问题是,有时它会做这些事情,有时则不会.

What my question is referring to it the former, the part of IDLE where you edit the code. Sometimes while typing, after a . it will display the available methods, or after an open parenthesis it'll give hints as to the values expected. but the thing is, sometimes it does these things, sometimes it doesn't.

推荐答案

目前我发现的唯一一件事是,如果 IDLE 的编辑会话与 python shell 连接(在问题中称为交互模式",即在一个尝试运行编辑过的脚本)然后非交互式"IDLE 可以根据交互式窗口中的值自动完成.例如,如果我输入

The only thing i found so far is that if an editing session of IDLE is connected with python shell (called "interactive mode" in the question, i.e. after an attempt to run the edited script) then "non-interactive" IDLE can autocomplete based on values in interactive window. For example, if I type

a = [];
a.appen

然后点击 <Tab > 它什么都不做,但如果我之前输入

and then hit < Tab > it will do nothing, but if I previously type

a = []

在相应的python shell中,IDLE会自动完成.

in corresponding python shell, IDLE will autocomplete correctly.

所以我唯一的建议是在 python shell 窗口中导入具有相同名称的相同模块,以使它们对非交互式 IDLE 编辑器可见".

So my only suggestion is import same modules with same names in python shell window in order to make them "visible" for non-interactive IDLE editor.

这篇关于蟒蛇空闲.自动完成/显示完成不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆