[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] newb: importing pygame



I am having a problem understanding how this person is importing modules. From the tutorial he has
this part:

################################
import pygame, sys,os
from pygame.locals import *
################################

I can understand hes importing modules, pygame, sys, os, but the 2nd line is whats confusing me.
When I see "from ...import" , from my understanding you import this way so you dont have to type
out the module name all the time. For example when you want to do system exit, you cant just do
"exit" you have to do "sys.exit" , so this person used "from" so he wouldnt have to write the
first part of the module name. Now if I am right about what I said before, how come hes importing
"pygame.locals" isnt it just supposed to be "pygame" and no dot something. And how am I supposed
to be able to tell if in his game tutorial if that function is already available or if its coming
from the pygame module, since now some of his code doesnt have to specify the first module name
since he did a "from...import"


-------------------------
http://www.boringdays.com