thanks @monomonnik that is correct
Posts made by frederik
-
RE: Can I use use areaAverage() to analyze an actual image?
-
RE: Auto-Resize FormattedString
why trying to find the pointSize? just scale everything with
textWidth/boxWidth
-
RE: Drawbot Preferences
you can not copy that file while the app is open, that pref file is always written when the app closes and will not sync when you adjust it
-
RE: Run drawbot.app as viewer only
DrawBot has not such a feature... however you can install DrawBot as a module and use it externally building the pdf and previewing it elsewhere
let use know if you find a solution!
-
RE: trim box in pdfs
tried it a long time ago... didnt got it to work for some reason, so support for trim and bleed is set on hold:
https://github.com/typemytype/drawbot/pull/304
if you got any idea to get it to work with quartz pdf context, let me know
-
RE: QRCodeGenerator(size, message)
hehe, totally forgot about that one... but I prefer the solution with
pyqrcode
as it provides a list 0/1 -
RE: QRCodeGenerator(size, message)
in the pip installer:
pyqrcode --no-deps
import pyqrcode blockSize = 10 qr = pyqrcode.create('http://www.drawbot.com/') for x, row in enumerate(qr.code): for y, bit in enumerate(row): if bit: rect(x * blockSize, y * blockSize, blockSize, blockSize) print(qr.code)
-
RE: QRCodeGenerator(size, message)
no idea... but the image is indeed blurry. A quick search for CoreImage filter
CIQRCodeGenerator
+ blurry results in lots of options but none of them apply to DrawBot.I would look at some python packages like https://github.com/mnooner256/pyqrcode to build the QR data and draw it with DrawBot, without round tripping to a png or image
good luck!
-
RE: when to apply paragraphBottomSpacing
I guess this is a coreText thing. When composing the same text with hard returns and soft returns (shift + enter) in TextEdit, there is no difference between soft and hard returns.
I guess you'll need to script it and change the the bottom spacing for text-runs with soft returns.
-
RE: listNamedInstances is broken ?
can you provide the not working google fonts?
and if this is persisting, it would be handy to open an issue in the drawBot repo.
thanks!
-
RE: Running Drawbot as a module in environments that aren't Mac OS X
DrawBot is mac only... that will not change fast as we got now a super high level of typographic support...
However Just started drawBotSkia which has a subset of the DrawBot api but uses skia as backend.
-
RE: Mute DrawBot warning ?
you can always ignore all warnings with:
import warnings warnings.simplefilter("ignore")
-
RE: BezierPath offset problem.
the mistake here is that bounds are not structured as
x
,y
,width
,height
as required forrect(...)
but asminx
,miny
,maxx
,maxy
.minx, miny, maxx, maxy = path.bounds() rect(minx, miny, maxx-minx, maxy-miny)
-
RE: Python Update ?
no, you can not.. but DrawBot exists also as a module where you can use your own python.
see https://github.com/typemytype/drawbot#using-drawbot-as-a-python-module
-
RE: Beginner Question
its all the same and very much based on coding flavours
different approach, similar result, here you know the amount of lines exactly.
import random size(600, 849) margin = 106 density = [3,2,7,20, 1002] # the amount of lines rows = len(density) row_width = width() - 2 * margin row_height = (height() - 2 * margin) / rows fill(None) strokeWidth(1) stroke(0) for i, d in enumerate(density): y1 = margin + i * row_height y2 = y1 + row_height x_positions = [random.random() * row_width for _ in range(d)] for x in x_positions: line((x, y1),(x, y2))
-
RE: Beginner Question
thanks @monomonnik! very well explained!
the while loop at the end makes its maybe a bit unreadable...
you can use
random.sample
to generate a random list easily:import random density = 5 result = random.sample(range(0, 100), density) print(result)
-
RE: Rewind rect() x position for endless movement
I guess you made it to difficult...
Variable([ dict(name="progress", ui="Slider", args=dict( value=0, minValue=0, maxValue=1, )), ], globals()) backgroundColors = [ (0.5, 1, 0.5), (0.5, 1, 1), (0.5, 0, 0), (1, 1, 0), (0.5, 0, 1), (0.5, 0.5, 0.5), (0, 1, 0) ] # pageW, pageH = (500, 500) pageW, pageH = width(), height() advance = pageW * progress itemCount = len(backgroundColors) itemWidth = pageW / (itemCount) moveIndex = int(advance * progress // itemWidth) backgroundColors = backgroundColors[-moveIndex:] + backgroundColors for i in range(0, itemCount + 1): color = backgroundColors[i] fill(*color) rect(itemWidth * (i-moveIndex) - itemWidth + advance * progress, 0, itemWidth, pageH) fill(None) stroke(0) strokeWidth(10) rect(0, 0, pageW, pageH)