Grasshopper's Panel to Eto form?

I’m trying to write Panel’s contents to an Eto Form. The problems I’m facing are the following:

1. The form always gets out of focus. I would prefer it to stay on top (or in Rhino’s window as a UI element).

2. I don’t know if I can dynamically update the form should the values change without re-launching it.

3. The form ignores Form().Shown check and opens a new window regardless.

I would appreciate any suggestions or directions. Thanks in advance.

panel-to-eto.gh (12.8 KB)

Have a look through this topic, it should help answer your questions:

Last post has latest code:

Thank you very much. That’s phenomenal. I’ll be sure to read through it.

I hate working with Eto…

You use

layoutB = ef.StackLayout()

lb = ef.Label(Tag=elName,ToolTip=elTip) 

layoutB.Items.Add(lb) 

and it works.

I use

layoutA = forms.StackLayout()

text = forms.Label()

layoutA.Items.Add(text)

and get the following error:
TypeError: Eto.Forms.Label value cannot be converted to Eto.Forms.StackLayoutItem in method Void Add(Eto.Forms.StackLayoutItem)

edit: however, following the suggestion in the error,

layoutA.Items.Add(forms.StackLayoutItem(text)) works.

It’s just strange to me that this conversion has to be done manually in my case and succeeds automatically in yours.

edit 2: possibly another GHpython != Python3 thing… and I can’t use GHpython because it has zero suggestions and I don’t know every possible API by heart.

I’m guessing that’s probably it. You can try using the IronPython 2 Script component instead. It uses the same Python version as GhPython:

Can you elaborate?

As you can see, it has no autocompletion hints, and it forces me to switch back and forth between “probing” objects in Py3 to get the hint, and then use the method in GHPy.


The same limitation applies to Py2.

But everything works properly under Py3.

edit: The autocomplete option is turned on in Py2.

Ah yeah, gotcha. I didn’t realise the new script editor had type-based autocomplete now. That’s really cool!

Well, any autocomplete will do, because I’m a beginner and I have a discoverability issue.

I managed to turn the form into a non-editable text box and vary its vertical span in accordance with the input list’s length.

However, .Close() only gets the window out of focus, without actually killing it.

Could anyone please tell me, is this an intended behaviour, or am I doing something wrong?

panel-to-eto rev2.gh (12.7 KB)