Hack Forums
[Python] VScode / Ubuntu / Pygame - autocompletion is missing - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Python] VScode / Ubuntu / Pygame - autocompletion is missing (/showthread.php?tid=6085874)



VScode / Ubuntu / Pygame - autocompletion is missing - Bastille - Jun 8, 2020

Hey fellows,

I just try to use some of the free time I currently have to improve my skills on Python. I'm following a tutorial on YT to create a game over Pygame.

The guy enters some lines, such as :
pygame.display.set_mode (to define the size of the window).

When I type :
Code
pygame.
I have the autocompetion, with choices such as
Code
display, draw, event
etc...

However, when I type
Code
pygame.display.
I do not have other autocompletion offers, such as
Code
set_mode

The guy in the tutorial is using PyCharm, and I'm using VS code, but I'm pretty sure the same thing is possible over VS code.

Do you guys have an idea about what is missing ?

Thanks


RE: VScode / Ubuntu / Pygame - autocompletion is missing - Lindros - Jun 8, 2020

Double check the import statements you are using. Did you just do
Code
import pygame
that? I'm assuming you installed it correctly if you are able to get the other methods.

Maybe try
Code
from pygame.locals import *

If you manually type
Code
pygame.display.set_mode()
does VS tell you that you get an unresolved reference?


RE: VScode / Ubuntu / Pygame - autocompletion is missing - Bastille - Jun 9, 2020

(Jun 8, 2020 02:36 PM)Lindros Wrote:  If you manually type
Code
pygame.display.set_mode()
does VS tell you that you get an unresolved reference?

Hi buddy, thanks for your time.

It doesn't tell me that I have an unresolved reference, if I try to run my program I can see a window which prompts, and then disappear (probably because I didn't define any time value for it). However here are some samples of what I have, a "MissingModule"

[Image: PKwJbr9.jpg]


RE: VScode / Ubuntu / Pygame - autocompletion is missing - Lindros - Jun 9, 2020

(Jun 9, 2020 11:14 AM)Yseurk Wrote:  Hi buddy, thanks for your time.

It doesn't tell me that I have an unresolved reference, if I try to run my program I can see a window which prompts, and then disappear (probably because I didn't define any time value for it). However here are some samples of what I have, a "MissingModule"

[Image: PKwJbr9.jpg]

Here is a post I've found from stackoverflow.

Quote:Have you checked if your version of python corresponds to your version of pygame, or if your version of pygame is 64 or 32 bit(so that it is the same as your computer)


Have you tried uninstalling Pygame, checking what python version you are running (you could have multiple versions on your computer) and then reinstalling Pygame after making sure it is compatible? Also make sure you don't miss any dependancies if there are some when installing.


RE: VScode / Ubuntu / Pygame - autocompletion is missing - Bastille - Jun 9, 2020

(Jun 9, 2020 11:25 AM)Lindros Wrote:  Here is a post I've found from stackoverflow.

Have you tried uninstalling Pygame, checking what python version you are running (you could have multiple versions on your computer) and then reinstalling Pygame after making sure it is compatible? Also make sure you don't miss any dependancies if there are some when installing.

Hum, tried on my Windows with both versions installed of Python and it works perfectly through VS code

I have Python 2.7 and 3.7 installed on my Ubuntu too, but doesn't work.

Maybe something is missing on my Ubuntu, such as you said some dependencies


(Jun 9, 2020 11:25 AM)Lindros Wrote:  Here is a post I've found from stackoverflow.


Have you tried uninstalling Pygame, checking what python version you are running (you could have multiple versions on your computer) and then reinstalling Pygame after making sure it is compatible? Also make sure you don't miss any dependancies if there are some when installing.

Just found the solution, sorry for the double post.

I tried to reinstall the Python module on VScode, didn't work, then I looked for Pygame and I found "Pygame Snippets" which I installed.

Now everything works fine 🤗