It looks like you're new here. If you want to get involved, click one of these buttons!
I have a grid of 100 images with specific x,y coordinates. I need to offset each image independently by a random amount between 0 and 50. What is the best way to go about this?
First part of the code makes a 10x10 grid of x,y positions. The second part draws circle on those positions.
kb = Keyboard()
# make a grid
positions = 
dim = 10
jitter = 50
cellwidth = 50
sx = x0-0.5*dim*cellwidth - 0.5*cellwidth
sy = y0-0.5*dim*cellwidth - 0.5*cellwidth
for xI in range(dim):
for yI in range(dim):
x= sx+ xI*cellwidth
y= sy+ yI*cellwidth
cv = Canvas()
for x,y in positions:
Hi Eduard, thank you so much, this definitely helps! Instead of drawing circles, what is the best way to achieve this using pictures in the library. I have multiple pictures to use and a target that is sometimes present, sometimes absent.
Does this part of the documentation help:
Conceptually, using circles and images are handled the same way.