Skip to content

Setting sketch size when using Py5Graphics? #524

Answered by hx2A
kresdjan asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @kresdjan ! Thanks for giving py5 a try.

Can you move the call to py5.size() to the beginning of the setup() function? You can have it after the global statements and comments but not after anything else. Like this:

canvas_width = 500
canvas_height = int(canvas_width * 1.41421)

def setup():
    global pg1, pg2, pg3
    py5.size(canvas_width, canvas_height)

    pg1 = py5.create_graphics(canvas_width, int(canvas_height / 3))
    pg2 = py5.create_graphics(canvas_width, int(canvas_height / 3))
    pg3 = py5.create_graphics(canvas_width, int(canvas_height / 3))

py5, like Processing, requires you to call size() at the beginning of setup(). The reason for this is that both py5 and Processin…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@kresdjan
Comment options

@hx2A
Comment options

@villares
Comment options

@hx2A
Comment options

Answer selected by kresdjan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants