Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
SFSymbols?
-
-
-
@JonB, looks to me like imageAsset is readonly.
-
-
Ok, a quick and dirty symbol browser here. Expects to have the list of symbol names linked above in the same directory.
Tap on row to copy symbol name to clipboard. Tap on ”Thin” to cycle through different weights. Symbols restricted by Apple for a specific app are shown in orange.
-
@mikael said:
quick and dirty
are reserved (by me) words, you'll have to pay royalties 😂
And, your code is never dirty... while mine, yes
-
@cvp strange, works on my ios9 ipad. ill have to play around with my ios13.
-
@JonB, must have changed since iOS 9? As said,
imageAsset
is now marked as readonly in the docs, and there is this statement in the first paragraph of UIImage:”Image objects are immutable, so you always create them from existing image data, such as an image file on disk or programmatically created image data.”
-
As a half-accidental result, you can use the file linked above as a package:
import sfsymbol img = sfsymbol.SymbolImage('arrow.right.to.line')
There are three optional parameters:
point_size
- Integer font sizeweight
- Font weight, one of sfsymbol.ULTRALIGHT, THIN, LIGHT, REGULAR, MEDIUM, SEMIBOLD, BOLD, HEAVY, BLACKscale
- Size relative to font size, one of SMALL, MEDIUM, LARGE
-
@mikael if you call your code dirty again, I promise to stop writing programs 😂
-
@mikael thanks for this, excellent. (If only it had a fuzzy search function... Just if you feel bored...)
-
@pulbrich, others, any suggestions for a fuzzy search?
fuzzywuzzy
is good, but I would like to avoid requiring an extra install.difflib.get_close_matches
results are highly unintuitive.Is there something easy to use provided by iOS?
-
@mikael you could try FuzzyFinder in 10 lines of Python
Cheers,
-
I would go with @TPO ‘s idea, perfectly enough for the purpose.
-
-
@mikael Many, many thanks! Perfect now!
-
@mikael said:
for some reason textfield.end_editing() does not hide the keyboard
Same on my iPad mini 4 (iOS 13 + Pythonista beta)
There is a kind of flicking, I think that the keyboard is dismissed and then comes back. -
FWIW:
from ui import * from objc_util import * uiimage=ObjCClass('UIImage') v=Image.named('test:Lenna') u=uiimage.systemImageNamed_('lessthan.circle') v.objc_instance._setImageAsset_(u.imageAsset())
Leading underscore did the trick, iPadOS 13.1.3.
Maybe not the most future proof, but does the job... -
@JonB As usual, you're the 🤴
-
@JonB, thanks. Intuitively this seems like it should be faster and more efficient than going via the PNG conversion.
But when I went to test the performance I ran into a couple of issues with the asset approach:
- Resulting image size is dependent on the size of the original ui.Image created.
- Both the original and ”asset-applied” images are retained in the ui.Image somehow, and for example ButtonItems do not really handle that well.
See below couple of example images. First one uses a too-large initializing picture (Lenna), the second too small one (triangle arrow icon), which you can see presented in the title area.