PyCharm autocomplete does not work with pygame

前端 未结 3 1079
伪装坚强ぢ
伪装坚强ぢ 2021-02-09 00:20

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:

<         


        
3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-09 00:43

    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:

    1. Go to your pygame folder and open init.py in a text editor
    2. Navigate to the import section with the try/except clauses (around line 109)
    3. Change the format from import pygame.module to from pygame import module for the modules you want

    For example, change

    try: import pygame.event
    

    to

    try: from pygame import event
    

    Restart PyCharm and it should work :)

提交回复
热议问题