Hi Guys,
I’ve been making good progress on using an ETO Form with WebView to build a UI for a Grasshopper based plugin.
What I’m now stuck on is detecting when the Form window is closed - so I can give users the option to open again or close rhino completely.
Here is my current Python code to launch the webview:
import rhinoscriptsyntax as rs
import scriptcontext
import Rhino
import Rhino.UI
import Eto as Eto
import Eto.Drawing as drawing
import Eto.Forms as forms
import time
import System
def OnClose():
rs.MessageBox(“Window was closed”)
my_webview = forms.WebView()
my_webview.Size = drawing.Size(200, 500)
my_webview.Url = System.Uri(‘http://localhost:3456/’)
launcher = Eto.Forms.Form()
launcher.Owner = Rhino.UI.RhinoEtoApp.MainWindow
launcher.Title = “WebView base UI for Grasshopper”
launcher.ClientSize = drawing.Size(480, 640)
launcher.Padding = drawing.Padding(10)
launcher.Resizable = True
launcher.Content = my_webview
launcher.Show()
Any tip to point me in the right direction?
Cheers
DK