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

Username:   Password: 
 RegisterRegister   
 Lua and Python Question
Index -> Programming, Python -> Python Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
clydex




PostPosted: Wed May 26, 2010 11:40 pm   Post subject: Lua and Python Question

Hi, i'm fairly new to python, and am trying to port something from lua into python.


    --[[
    bell = Image.createEmpty(20,20)
    bell:clear(Color.new(255,255,255))]]
    bell = bell or Image.load("bell.png")
    bell_width = bell:width()
    bell_height = bell:height()


I'm wondering what the first and last 2 lines do to the image, and how I would code that in python. Thank you.
Sponsor
Sponsor
Sponsor
sponsor
BBil




PostPosted: Thu Nov 11, 2010 5:07 pm   Post subject: Re: Lua and Python Question

bell_width = bell:width()
bell_height = bell:height()

This looks eerily similar to a couple lines of code from something i made. keep in mind that I am using pygame

self.width=self.pirate.get_width()
self.height=self.pirate.get_height()

So this pretty much just sets up 2 variables to be the exact same width and height of a picture (surface in pygame lingo)
Canada Canada Canada Canada Canada
jcollins1991




PostPosted: Thu Nov 11, 2010 10:07 pm   Post subject: Re: Lua and Python Question

The first two lines create an image, then if it's able to load the "bell.png" image it overwrites it. The last two lines don't do anything to the image, they just access the width and height values of the image. I don't think there's anything in the python standard libraries to do image processing, but there are libraries available that might be able to imitate this functionality http://www.pythonware.com/products/pil/
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: