Skip to content

Instantly share code, notes, and snippets.

@freitzzz
Created May 15, 2024 21:06
Show Gist options
  • Save freitzzz/53e09ac724637ca37d1e2b898858cc57 to your computer and use it in GitHub Desktop.
Save freitzzz/53e09ac724637ca37d1e2b898858cc57 to your computer and use it in GitHub Desktop.
krita pyton move layers
from krita import *
import random
application = Krita.instance()
currentDoc = application.activeDocument()
currentDocWidth = currentDoc.width()
currentDocHeight = currentDoc.height()
# gets layers that are not nested
# you will need to loop through them if you want all layers
nodesList = currentDoc.topLevelNodes()
for layer in nodesList:
layer.move(random.randrange(0, currentDocWidth), random.randrange(0, currentDocHeight))
print(layer.position())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment