Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Formatting label texts with python

$
0
0
Hello everyone.
I am new to python programming and just managed to write a code to label features with particular field.

Here is the code that I am using for labeling. After specifying map and layer..

if layer.supports("LABELCLASSES"):
for lblclass in layer.labelClasses:
lblclass.showClassLabels = True
lblclass.expression = " [type]

*I'm creating labels based on [type] field.

Next step is, set the format for the labels.

I am assuming I want to do something on lblclass.expression line..

like surrounding [fieldname] with text-formatting tags.

So I tried this code, lblclass.expression = "<BOL>[type]</BOL>"

and refreshed, but the labels disappeared, and they reappear when I just type lblclass.expression = "[type]"

It does not show any error message, but it just does not work. Same thing in <ITA><\ITA> code.

Does anybody have any idea how to solve this problem?

Any help will be greatly appreciated.

Thanks in advance!

Viewing all articles
Browse latest Browse all 2485

Trending Articles