Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 creating images and checking pixel in python
Index -> Programming, Python -> Python Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
shaon




PostPosted: Mon Jan 07, 2008 7:34 pm   Post subject: creating images and checking pixel in python

In turing it's possible to create an image and save it in memory with Pic.new(x,y,x1,y1) <--- the program would hold whatever is in this rectangle and memory and you could use it like any other image. I was wondering if Python or Pygame has any built-in function like that lets users create images by holding parts of the screen in memory.

My 2nd question is what is the function in Pygame that lets users check the colour value of a pixel? Im sure most likely it has one.
Sponsor
Sponsor
Sponsor
sponsor
Ultrahex




PostPosted: Mon Jan 07, 2008 7:51 pm   Post subject: Re: creating images and checking pixel in python

1st Question: Check Pygame Documentation, I think Images are Surfaces in Pygame? If i am incorrect .... well my bad...
2nd Question: If My Assumption is correct .... if the entire screen is a Surface then you use Surface.get_at((x, y)): return Color

Pygame Documentation For Surfaces: http://pygame.org/docs/ref/surface.html
Pygame Documentation For Images: http://pygame.org/docs/ref/surface.html
McKenzie




PostPosted: Mon Jan 07, 2008 9:16 pm   Post subject: Re: creating images and checking pixel in python

I think hex is right that the answer is in the surface documentation. You can take a subsurface, but it will actually share pixels with the original (i.e. changes to one affect both). To stop it from sharing use copy(). Hex is right about get_at().
Display posts from previous:   
   Index -> Programming, Python -> Python Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: