How to run Eto Form in parallel with Rhino?

When I initialize an Eto Form, how to make Rhino still usable when Eto Form is running?

import Rhino
import Eto.Drawing as drawing
import Eto.Forms as forms
class Dialog_Rhino(forms.Dialog[bool]):
    def __init__(self):
        self.Title = "Eto Form"
        self.ClientSize = drawing.Size(400, 200)
        self.Padding = drawing.Padding(5)
        self.Resizable = False
        layout = forms.DynamicLayout()
        layout.Spacing = drawing.Size(5, 5)
        layout.AddRow(None, self.create_button("TEST A"), self.create_button("TEST B"), self.create_button("TEST C"))
        self.Content = layout
    def create_button(self, text):
        button = forms.Button()
        button.Text = text
        button.Click += lambda sender, e: forms.MessageBox.Show(self, "YOU PRESS: " + text)
        return button
def show_dialog():
    dialog = Dialog_Rhino()
    rc = dialog.ShowModal(Rhino.UI.RhinoEtoApp.MainWindow)
    if rc:
        # Your logic for processing the dialog result
        pass
if __name__ == "__main__":
    show_dialog()

Rhino is not usable.

This is the desired behaviour for a dialog, and also what modal means. You block the UI thread until the user closes the dialog. You want a Form instead.

1 Like

Thank you! I did it

1 Like