but unless you are importing code
Clear. I will look into JSON then. I only load some settings for size and speed and such. Thanks again.
@gferreira Ah nice, that works.
Just have 2 questions/wishes left. Tried googling, but these things look so confusing to me...
I know have this:
from importlib import reload import settings_new reload(settings_new) from settings_new import *
Which works. Ideally I would let people set a variable (in this case) called
settings_new at the beginning of the code and fill the import things in automatically. So they don't have to change this on 3 places.
I could get the
reload to work with a variable as the module-name, but not the
from ... import * part. Can I do this?
Also, can the module be in another folder? It's a subfolder of the root where the code is in. So not a complete other location.
@gferreira Thanks for your quick reply. I actually was trying something like that, but couldn't get the variables out.
It's working now, but I have to restart Drawbot everytime I want to load new settings. I can't just resave the settings file and rerun the script, it'll use the old variables.
I think it sounds best to load something from an external JSON file. I will look into that.
Basically I want the designers who use my code to keep a folder of different settings they can use for different outcomes. Now they save multiple versions of the code...
Is it possible to load a python file in another file in Drawbot? Have been googling for pure python solutions, but I can't get it to work.
Basically what I want:
I have my main python code which I run to generate a movie. I want to load the 'settings' (just a bunch of variables I set in the beginning of the code) from another file. This way I can update the code and have the designer save different sets of settings and load these. What would be the way to go about this?
I tried something like settings a function in the
settings.py file and import that, but no luck.
I'm looking for a way to create a simple interactive Drawbot script, where users can fill in a couple of text fields, run the code, and end up with a movie.
I can find something about the Variables in the documentation, but I'm not sure how to go from there.
Basically, I have 3 questions:
I understand these are quite 'broad questions', but I'm just looking to get pointed in a general direction.
Has been a while since the last post, but just wanted to thank you guys again for the help. It all worked out great and the project is live (can I post this here?): https://www.instagram.com/p/Bsx6AhVhlNf/ Thought you guys might enjoy this!
I know the title is kinda vague, I can provide more info if needed of course:
I have a script that runs and creates frames with text and saves it as a mp4. Right after running (takes a couple of seconds) Drawbot freezes. Have to Force Quit it. It DOES complete the whole script since it saves a perfectly good MP4. Any way to make sure this doesn't happen? Can I save a MP4 without displaying the pages for example?
With less frames (about 50) it also freezes for a while, but will unfreeze after showing all the pages. with 250 frames it just freezes and stays that way.
Update: it does the same thing when not saving as a MP4. It just runs, goes through all the frames, and then takes a long time displaying the pages. Is there a better way to do this?
I tried this (B is the bezierPath).
This doesn't work:
fontVariations(wdth = self.vw) self.B.text("E", (0, 0), fontSize=100, font='Variabletest-Thin')
Is there another syntax I should be using? I don't get any errors btw.
This is kind of a follow-up question to another forumpost of mine.
I have a bezierPath where I draw a letter. After that I scale this shape to a certain size. I just can't find a way to draw the letter with using fontVariations.
(I know how to use fontVariations when I just draw text outside of a bezierPath. So the font is working.)
Any ideas on how I can do this?
@frederik Thanks. Will have a look which type gives the best result. To use the actual font sounds like a good choice though. In Processing (where I made this animation first) I used SVG, but mainly because it's almost impossible to work with type in Processing. Curious which one is faster also.
I have the feeling this should be easy, but I can't find a way to do this:
Draw a letter to fill up a certain viewbox (which I can change).
What I've tried:
Any ideas? Thanks in advance!
I tried installing the module svglib which is supposed to do what I want, but I end up in a maze of installing other modules and end up with errors in the lxml module.
I'm in no way experienced in Drawbot and/or Python, so I have no idea what I'm doing... This sounds too difficult for what I'm trying to do, right?
Is there a simple way to load a SVG file (just as you would load an image) and display it?
I don't need to do all kinds of editing with it, just displaying the svg in a certain size.
I'm currently lost in all kinds of SVG modules that do all kinds of things, except just loading a simple file... Thanks!