Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

VScode / Ubuntu / Pygame - autocompletion is missing

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
[Image: support-brown.png]
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?
[Image: Iu0EfTL.gif]
(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]
[Image: support-brown.png]
(Jun 9, 2020 11:14 AM)Bastille 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.
[Image: Iu0EfTL.gif]
(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 🤗
[Image: support-brown.png]


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by Hannah MontanaFeb 22, 2021 03:37 AM 14 597 Feb 22, 2021 03:37 AM
Last Post: dark8888
[Python] by SansGamerNov 4, 2020 07:59 AM 2 129 Nov 4, 2020 07:59 AM
Last Post: SansGamer
[C] by dsp250May 11, 2020 04:41 AM 6 162 May 11, 2020 04:41 AM
Last Post: Shisho