Archive — page 9
Posted on 04 August, 2020
Continuing the development of a project to provide an API to draw ‘stacked doughnut’ charts (see Parts One and Two for the story so far).
A Font Of Knowledge
Now that we have our arcs being drawn and text labels being shown, the next thing to worry about is icons.
To draw icons we ideally want to have a set of pre-designed images — and wouldn't it be nice if they
were wrapped up in a font package? Happily we can get just that by using Font
Awesome — and even better, there's a Python package
font-font-awesome which is also compatible with the
fonts module that we previously installed.
pip3 install font-font-awesome
And then we need to add another import — note that this is from fonts.otf rather than fonts.ttf,
since Font Awesome is an OpenType rather than TrueType font.
Posted on 03 August, 2020
Continuing the development of a project to provide an API to draw ‘stacked doughnut’ charts (see Part One for the story so far).
Can I Get A Title?
When we left off we had a working proof that could draw a series of arcs (assumed to be three) based on data passed in ‘JSON-like’ format. The next part of the task is to add labels to form the chart legend.
I want to be able to use a font of my choosing rather than rely on whatever default PIL/Pillow
uses. In theory that’s fine — there’s a function to read in a font file — but because I can’t be
absolutely certain (for the time being) what system I’ll be deploying to whilst testing, and
therefore what fonts may be available, I need to worry about bringing fonts in through code.
Enter the Python fonts package, courtesy of Phil Howard(otherwise known as Gadgetoid) at Pimoroni. This provides a nice method for finding and importing fonts, and alongside it there are a number of open-source fonts that have been packaged up to also easily be importable through code.
... morePosted on 02 August, 2020
So I have an account over on People Per Hour and came across a fun little project over the weekend. I'm waiting to see whether my proposal will be accepted, so there's a chance this will never be posted (!), but it was an interesting little challenge to solve.
Project Requirements
The requirements were:
- provide a server-based API (absolutely NOT a front-end) ...
- ... which generates 'stacked' doughnut charts ...
- ... with text overlays ...
- ... and returns an image URL that can then be embedded within a document
An example of the required output image was provided:
Example image provided
... morePosted on 15 August, 2019
Why would you want to? I mean, it's not like they're popular or anything ...
Having not posted on the blog for a while, decided I'd write a little something on the morning train; however for whatever reason the Wordpress app for iPad will not, in any way, no way no how connect to and/or update the live site.
I know, why don't I just delete the site and re-connect?
And nope, that's not going to work - frankly no idea what the app designers were thinking, but there is no easy way to delete a site from the app.
Hide it? Yup, no problem.
Delete it? No way, why would you want to do that?
... more