Rhino version: Rhino 9 WIP (Grasshopper 2)
OS: Windows
## What I’m trying to do
Show a simple Eto.Forms.Dialog from a GH2 Python component, triggered by a Boolean input.
## Step 1 - initial attempt
```python
import Eto.Forms as forms
import Eto.Drawing as drawing
import Rhino
if Show:
dialog = forms.Dialog()
dialog.Title = "GH2 Test Venster"
dialog.ClientSize = drawing.Size(300, 120)
dialog.Content = forms.Label(Text="Hallo vanuit Grasshopper 2!")
dialog.ShowModal(Rhino.UI.RhinoEtoApp.MainWindow)
```
Result:
```
Error running script: The calling thread must be STA, because many UI components require this. [1:1]
```
This suggests GH2 Python components are (at least sometimes) executed on a non-STA thread.
## Step 2 - wrapped in RhinoApp.InvokeOnUiThread
```python
import Eto.Forms as forms
import Eto.Drawing as drawing
import Rhino
import System
def show_dialog():
dialog = forms.Dialog()
dialog.Title = "GH2 Test Venster"
dialog.ClientSize = drawing.Size(300, 120)
dialog.Content = forms.Label(Text="Hallo vanuit Grasshopper 2!")
dialog.ShowModal(Rhino.UI.RhinoEtoApp.MainWindow)
if Show:
Rhino.RhinoApp.InvokeOnUiThread(System.Action(show_dialog))
```
Result: No error, but also no window appears (checked taskbar and Alt+Tab, nothing found).
## Step 3 - tried non-modal Show() instead of ShowModal(), plus keeping a
persistent reference via scriptcontext.sticky (to rule out early garbage
collection of the dialog object):
```python
import Eto.Forms as forms
import Eto.Drawing as drawing
import Rhino
import System
import scriptcontext as sc
def show_dialog():
dialog = forms.Dialog()
dialog.Title = "GH2 Test Venster"
dialog.ClientSize = drawing.Size(300, 120)
dialog.Content = forms.Label(Text="Hallo vanuit Grasshopper 2!")
sc.sticky\["gh2_eto_test_dialog"\] = dialog
dialog.Show()
if Show:
Rhino.RhinoApp.InvokeOnUiThread(System.Action(show_dialog))
```
Result: still no window, no error.
## Confirmed via debug output
Added an Info output printing the received Show value and its type - confirms
Show arrives correctly as Python bool True, and the code path does reach the
InvokeOnUiThread call (no exceptions thrown at any point in steps 2/3).
## Question
- Is there a currently-recommended way to show an Eto.Forms window from a GH2
Python component, given that the component’s script apparently runs off the
main UI thread?
- Is InvokeOnUiThread the correct mechanism for GH2, or is there a GH2-specific
equivalent I should be using instead?
Happy to provide more details, a minimal .ghx repro file, or test any suggested fix.