Oh, I've been trapped by a bot it seems Still, my answer may be useful
Just van Rossum
Posts made by justvanrossum
RE: Using a virtualenv in Drawbot
Oh, that's a clever idea, thanks for sharing.
... said in Using a virtualenv in Drawbot:
You should be able to make that happen automatically. Please try the following:
- Create a folder called
/Library/Python/3.6/site-packagesif it doesn't already exists
- place a file in there with a
- write the line
/Users/maartenidema/t_venv/lib/python3.6/site-packagesinto that file
- Restart DrawBot and see if you can now import from your venv.
Sorry, I didn't test this. Please let us know if it works.
- Create a folder called
Rotating arrows exercise
This is by no means an original idea, but it's a fun thing to program.
Triggered by Mike Duggan: https://twitter.com/mickduggan/status/1090577885067386880
# triggered by Mike Duggan: # https://twitter.com/mickduggan/status/1090577885067386880 def arrow(center, size, rotation, barThickness, arrowhead): with savedState(): translate(*center) scale(size) rotate(rotation) points = [ (-0.5, barThickness/2), (0.5 - arrowhead, barThickness/2), (0.5 - arrowhead, 0.5), (0.5, 0), (0.5 - arrowhead, -0.5), (0.5 - arrowhead, -barThickness/2), (-0.5, -barThickness/2), ] polygon(*points) def arrowGrid(numArrows, arrowSize, barThickness, arrowhead, rotation): for i in range(numArrows): x = i * arrowSize for j in range(numArrows): y = j * arrowSize arrow((x, y), arrowSize, rotation, barThickness, arrowhead) def easeInOut(t): assert 0 <= t <= 1 return (1 - cos(t * pi)) / 2 canvasSize = 400 numArrows = 4 arrowSize = canvasSize / numArrows barThickness = 0.5 arrowhead = 0.5 rotation = 180 duration = 4 framesPerSecond = 15 numFrames = duration * framesPerSecond for frame in range(numFrames): t = 4 * frame / numFrames quadrant = floor(t) t = easeInOut(t % 1) angle = ((quadrant + t) * 90) % 380 flip = quadrant % 2 angle = -angle newPage(canvasSize, canvasSize) frameDuration(1/framesPerSecond) if flip: fill(1) rect(0, 0, canvasSize, canvasSize) fill(0) arrowGrid(numArrows + 1, arrowSize, barThickness, arrowhead, angle) else: fill(0) rect(0, 0, canvasSize, canvasSize) fill(1) translate(-arrowSize/2, -arrowSize/2) arrowGrid(numArrows + 2, arrowSize, 1 - barThickness, arrowhead, angle + 180) saveImage("Arrows.gif")
@mauricemeilleur It's part of the "pen protocol" which lives in with FontTools, so any documentation should go there. It's documented in the code, have a look at the
The main trick for the blobs is indeed the fact that the contour will have no on-curve points, and that is achieved by passing
Noneas the last argument to
RE: How to run Drawbot on a server: Does it is possible?
@agyei Sounds like that should work.
RE: listFontGlyphNames() returning Alphabetical order?
@guidoferreyra It looks like DrawBot could be changed to do that, yes. Please file an issue on github. In the meantime, you could do it yourself via fontTools:
from fontTools.ttLib import TTFont font("AGaramondPro-Regular") f = TTFont(fontFilePath()) print(f.getGlyphOrder())