Cannot access size in the Python mode

edited March 2016 in Python Mode

I understand that with the upgrade, size has to be worked a bit differently. However, surface and setSize do not seem to be recognized in the Python mode. I don't know what to use. I have gotten some help on this, but the examples were Java and when I tried in Python I got an error. Screen Shot 2016-03-10 at 9.12.44 AM

Answers

  • edited April 2016 Answer ✓

    There's no reason to access the internal state of the sketch. What are you actually trying to accomplish? If you're just trying to set the size of your sketch to the size of some image, then you can do that in the settings function.

    def settings():
        global img
        img = loadImage("foo.png")
        size(img.width, img.height)
    
    def setup():
        noLoop()
    
    def draw():
        image(img, 0, 0)
    
Sign In or Register to comment.