Hi,
I made some automatic Python stacked labels but I am just looking at how to justify "Center" these labels. I cannot find the 'center' button in all the tabs! Any guess?
Thanks
hmmm don't make maps much and label less, but let's see how pythonic Pro is in that regard
label = "hello"
frmt = "{!s:^15}\n{!s:^15}".format(label, "Vincent")
print(frmt)
hello
Vincent
So it 'label' were your field, then you just need the stuff to the right of the = sign
Tried it! But not luck. Nothing happened on the map.
looks like an html designator for bold and italics... perhaps that is what you need for the labeling.
The formatting I send would require a 'print' which I guess labelling doesn't do..
But bookmark https://docs.python.org/3.6/library/string.html for working with strings in python 3.. it is a whole new world
Tried to encapsulate the print statment but no luck. Stacked labels are not justified "Center"
It did not produced an error though!
found it Text Formatting tags
not there
but if this doesn't work...
a = 'hello'
a.center(10, " ")
' hello '
but desperate times
def lbl(a, pad=10):
"""attempt to center"""
sp = " "
sides = (pad - len(str(a)))//2
out = sp*sides + str(a) + sp*sides
return out
lbl('hello')
' hello '
strangely bumped in June?