Skip to content

Instantly share code, notes, and snippets.

@hamukazu
Last active July 14, 2023 10:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hamukazu/fd59d621c1ab875852cad3cb7b3fb0bc to your computer and use it in GitHub Desktop.
Save hamukazu/fd59d621c1ab875852cad3cb7b3fb0bc to your computer and use it in GitHub Desktop.
# ランダムに円を100個描いたSVGファイルを作成します。
import svgwrite
import random
drawing = svgwrite.Drawing("a.svg", size=("400px", "400px"))
s = dict(stroke=svgwrite.rgb(0,0,0,"%"), fill="white")
for _ in range(100):
x = random.randrange(0,400)
y = random.randrange(0,400)
r = random.randrange(10,50)
c = svgwrite.shapes.Circle((x,y),r,
**s)
drawing.add(c)
drawing.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment