Leader text created in Python vs Rhinoscript

We’ve been noticing a difference in behaviour between leader text created in Python vs. Rhinoscript with regard to maintaining the line separations. It’s probably best to watch these two screencasts.

First Rhinoscript:

Notice how the format of the label (line separation and spacing) remains intact despite resizing the edit box. This is text string had the lines separated using VbCrLf.

Now look at how the Python version behaves:

This is a mess without even resizing the edit box. Resizing it goes from bad to worse. I’ve tried both \n and os.linesep in Python but the results are both the same, and the format of the label is lost as soon as the edit box appears. For what it’s worth, editing in the Properties pane is also a mess.

Is there a way in Python to achieve results closer to VB’s VbCrLf functionality? We need the format to withstand editing, as editing is a common occurrence on these types of labels.



Here is a sample of each label in case anyone wants to play around with it.

text samples.3dm (79.5 KB)

Hey Dan,
Don’t know anything about python, but it looks like it may simply be the difference between “\r\n” (carriage return / line feed) and a simple “\n” (newline). How are you defining your line breaks in python? If you are using the common “\n”, try “\r\n” .
Hope that helps,

No, the typewriter has not left us… :smile:

Hi Tom,

This is exactly what I needed. I wasn’t aware that the “carriage return” transcended time and still existed in Python.

Thanks for pointing this out.