I've just installed PyCharm Community Edition 3.4.1 and tried to make a simple pygame project in it. I found that code completion runs in a weird way. In this case:
from pygame import event
event.
when I type event.
a completion popup with event
methods shows immediately. But in the second case:
import pygame
pygame.event.
a popup contains only object
methods.
How can I learn the autocomplete tool to look deeper into the library?
It has to do with how pygame is constructed.
The:
File contains the following construction:
Which allows missing imports. However, this confuses pycharm. Removing the try+except will fix the pycharm auto completion.
Other than creating your own skeletons, you can't. You can make pycharm a little better a code completion if you enable the following:
But other than that, you're out of luck. Python is hard to make code completion for because its a dynamic language, and stubs (skeletons) don't exist for everything.
I tried Daid's answer (removing the try/except in init.py) and it didn't work, but it was very close! Here is how you can fix it specifically for pygame:
For example, change
to
Restart PyCharm and it should work :)