Two Questions about Rhino's Python Editor

I have to admit I am not in the ‘manual readers camp’, so the questions are perhaps really lame:

  • When I run a script in Rhino’s Python editor the window closes and immediately opens again: Can I change that to ‘script runs without affecting the window’?

  • And can I turn on line wrapping for the output?

Not as far as I know, this appears to be an option in the vb rhinoscript editor, but not in the python editor.

What do you mean by “output”? print statements?

–Mitch

I mean this tab here:

The line not wrapped here e.g. has 1800 columns. Using the scroll bar in such a situation is not recommended. :wink:

Correct, if you print a list it does not wrap… don’t know if this can be changed at some point.

As a workaround:

import Rhino.Geometry as rg
for item in dir(rg): print item

In any case you have 1800 entries to scroll through… --Mitch

1 Like

It doesn’t wrap strings, either… Like never… Thanks!

Yep, if you have a very long string, you will need to concoct something to insert line breaks… If it’s a series of words separated by spaces or some other common delimiter, you can turn it into a list by using my_list=my_string.split("delimiter") then print the list in a loop as above…

–Mitch

Do we know the width of that Output tab? Because then a real workaround could be written using Python’s built-in textwrap:

import textwrap
for line in textwrap.wrap(text, 80):
    print line

Obviously this makes more sense when we know how much space we have in that Output tab.