Panel User Text Python Gh

If i need to write a multi linear data to a panel, how do i do such ?

*ignore sticky (4.8 KB)


How about '\n'.join(my_list). ?

Note that you should avoid using the built in name list for your list


Something like this will work.

import Grasshopper as gh

def WritePanel():
    for obj in ghenv.Component.OnPingDocument().Objects:
        if type(obj) is gh.Kernel.Special.GH_Panel: 
            if obj.NickName in _PanelName: 
                value = '\r\n'.join(map(str, _Text))
                obj.UserText = value
if _Set:

NOTE: In this example, the input text panel and the Receive text panel are set to multi-line. The type hint for the _Text and _PanelName inputs are set to string, and List Access.

I am trying to make a loop. When z=True, it just go continuous loop. Any idea why?

1 Like

I’m afraid I might have misunderstood your original question. From the screenshot you uploaded, I’m a little confused.
The example I posted was how to write values to a named/unconnected panel that is present on the canvas. Are you trying to stream/parse the contents of a log file or something?
Your code looks like, when your boolean (x) is set to true, it is continually updating your list? I’m not entirely sure what you are trying to do with your list.
Maybe we could start with trying to identify the parts of the problem you are trying to solve?
1 - What is the input/data you are starting with?
2 - Does that data need to be parsed in some capacity?
3 - Where/what do you want to do with the output values?

In case somebody finds this, here is how you change the “Receive” panel to multi-line via code: