2

total beginner in Python here. I installed Python 3.6.5 on my Mac and I am using the default IDLE. When I did VBA or Java (long time ago), there used to be pop-up help/completion suggestions after you typed "." (for example).

How do I make it happen in IDLE?

EDIT// There is another thread asking essentially the same question however, it is six years old. I did not want to ressurect such an old thread since a lot has changed, I assume.

Bottom Line: Is it possible to have an "interactive help" pop up as I am typing using the IDE which came with Python?

Achilies
  • 21
  • 1
  • 3
  • Possible duplicate of [Python IDLE. Auto-complete/Show completions not working](https://stackoverflow.com/questions/9089476/python-idle-auto-complete-show-completions-not-working) – Jonathan Anctil Jul 06 '18 at 20:34
  • 1
    Edited for more clarity. Essentially, I am missing the autocomplete pop-ups that for example pyCharm offers. If IDLE is doing it as default, then mine's not working, I guess. Thanks for any tips on how to make it work. – Achilies Jul 06 '18 at 22:44
  • The 'default IDLE' would normally mean the IDLE that is part of the default Python 2.7, installed by Apple. So I am not sure which version you run. For auto completions, read https://docs.python.org/3/library/idle.html#completions. Note " Run the module once with your imports". When I write a module, I tend to run it multiple times to check for errors as I go. So the 'possible completions' list gets constantly updated. Aside: Upgrading to 3.6.6 should not affect completions, but it has some other IDLE changes. This is currently true of most every maintenance release. – Terry Jan Reedy Jul 07 '18 at 20:49

2 Answers2

4

I don't know if this apply to 3.6.5 but here is a solution to 3.7.

  • MacOS 10.14.4
  • Python 3.7.3
  • Installed from python.org
  • Tk version: 8.6.8

Test if this is your problem:

If you type str( you should see a calltip explaining str. (e.i.str(object='') -> str).

However if you type str.(tab) and don't see a window, then this worked for me.


Go to the file autocomplete_w.py. You can find the file path by:

>>> import idlelib.autocomplete_w
>>> idlelib.autocomplete_w
/the/path/to/autocomplete_w.py

(The default path is /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/idlelib/autocomplete_w.py)

And in this file add line 200:

197        scrollbar.config(command=listbox.yview)
198        scrollbar.pack(side=RIGHT, fill=Y)
199        listbox.pack(side=LEFT, fill=BOTH, expand=True)

200        acw.update_idletasks() ##### ADD THIS to fix the autocomplete

201        acw.lift()  #...
The Matt
  • 1,423
  • 1
  • 12
  • 22
  • No, didn't work for me, unfortunately. It must be my machine. But thanks for the fix as it might help someone else. – Achilies Apr 04 '19 at 23:42
  • This behavior may also have something to do with the OS version. Are you on the latest OS? You may want to try a fresh install of 3.6.5 from python.org and try this fix again. – The Matt Apr 06 '19 at 00:51
  • Matt, thanks for the tip. I will try to do that. If I don't respond, it worked ;) – Achilies Apr 07 '19 at 18:47
  • This edit worked for me running Python 3.7.3 in `/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/` – Eric Clack Jun 12 '19 at 08:06
  • Did not work for me running Python 3.7.4 (v3.7.4:e09359112e, Jul 8 2019, 14:54:52) on OS X 10.13.6 – Pup Jul 23 '19 at 13:35
  • Interesting. I notice you have a different version # than me. v3.7.3:ef4ec6ed12 – The Matt Jul 26 '19 at 12:09
1

When I run Idle I use the tab key for autocompletion. If I type pri for example, and then hit tab key, pri becomes print. If there are multiple commands tab key opens a pop-up for you to chose.

Natsfan
  • 4,093
  • 3
  • 22
  • 29