Skip to content

Tag: python

How can I get a glyph with holes(Python)?

These are frameworks that I use: I have a svg file looks like the image below this sentence(The image is upside-down). SVG file I load this file and add to Defcon.Font like this: But after I export this Font object with ufo2ft, The glyph’s hole has disappeared :( After Export I don’t know how to m…

How to strip only specific parts of a list element in Python

So lets say i have a list, where one element contains an ‘hour-minute-second-tagnumber’, like this: How do I make this of an element: ‘103012 TTH-312’? Can I .strip only specific parts of an element somehow? Answer You can limit the number of replace to 2. Output If you are trying to d…

How to bind Tcl callbacks in Python

I was reading about msgcat. Quote from the docs: ::msgcat::mcunknown locale src-string ?arg arg …? This routine is called by ::msgcat::mc in the case when a translation for src-string is not defined in the current locale. The default action is to return src-string passed by format if there are any argum…

Type annotation for partial functions

we have multiple partial-like functions with same type annotation with args and kwargs like: can I somehow create a template for functions apple, orange, banana and assign it to them? I thought about Protocol with __call__ definition, but it is unclear how to assign it to functions Answer Rather than a functi…