
-
-
JonB
ICloud folders are funny, and not a subfolder of pythonista.
Try having a script in the main path, which you can then use cd or sys.path.insert to add the iCloud path, and maybe runpy or import, etc.
-
JonB
There are a few ways, depending on what you are trying to do.
If you want to read tabular type data,
csv
is a fine option. For saving python variables,marshall
orpickle
are good, andjson
oryaml
also read into dicts, and produce readable files. If you literally just want to store one double per line without any context, you could simply call float. Or, if you are usingformat
to write each line, useparse
as the inverse of format.For just reading/writing your own format, you can use
for line in f: my_num=float(line) #do something with my_num...
-
JonB
If you type from math import *, then you can use the symbols without typing math.
Or you can import specific names.
Eg
from math import pi Or from math import *
Both would expose
pi
While
import math
Means you must use
math.pi
Often, it is considered bad form to use
import *
, because then it can be hard to tell where some attribute or function comes from. By being explicit, your code will be easier to follow.Usually, if you have imports that can be used in multiple functions , import at the top of the file.. if you have one import that is used in one function, and it is a big import, and the function is rarely used, then it can sometimes make sense to import inside a function.
. -
JonB
I think compact is for watchOS, Pro for iOS.
Does UIFont have a .fontName() method?
-
JonB
Try
".SFCompactText-Bold"
Or
".SFProText-Bold"
Also-- the "Text" part of the name can be replaced with Rounded, or Display. Apparently Text is supposed to used under 19pt, Display for 20pt+. I'm not sure what Rounded is for -- looks a little more informal.
I think apple tried to obfuscate system font names so people used their new API in iOS13, to prevent people hard coding fonts that might change later. Hence reason that .SFUI doesnt work
I assume draw_string is using UIFont.fontWithName_size_
-
JonB
So, a way that should work would be to use UIFont to find the system font name, and then create a bold version, then find the name of that... Just an idea, have not pursued it yet
-
-
JonB
What if you call from within tableview_did_select? Or, add
@on_main_thread
before your button action? -
JonB
Are you reading this from within a tableview callback? Share some code?