I cannot understand how eto work

import rhinoscriptsyntax as rs
import Rhino.UI
import Eto.Drawing as drawing
import Eto.Forms as forms
__commandname__ = "FindHole"

class SimpleEtoDialog(forms.Dialog):

    def __init__(self):
        self.Title = "Sample Eto Dialog"
        self.ClientSize = drawing.Size(200, 200)
        self.Padding = drawing.Padding(5)
        self.Resizable = False
        layout = forms.DynamicLayout()
        layout.Padding = drawing.Padding(5)
        layout.Spacing = drawing.Size(5, 5)
        layout.AddRow(forms.Label(Text ="i !"))
        layout.AddRow(forms.Label(Text ="am"))
        layout.AddRow(forms.Label(Text ="NOT"))
        layout.AddRow(forms.Label(Text ="WORKING!"))

################################################################################
# Creating a dialog instance and displaying the dialog.
################################################################################
def TestSampleEtoDialog():
    dialog = SimpleEtoDialog()
    dialog.ShowModal(Rhino.UI.RhinoEtoApp.MainWindow)
    
################################################################################
# Check to see if this file is being executed as the "main" python
# script instead of being used as a module by some other python script
# This allows us to use the module which ever way we want.
################################################################################
if __name__ == "__main__":
    TestSampleEtoDialog() 

i simply try to edit a ETO sample but other than changing the string i cannot understand the correlation from Layout and effect

Hi @s.branca,

Layouts are used to organize controls on your form. Eto includes a couple of different types of layout classes.

https://github.com/picoe/Eto/wiki/Containers

Here is some info on DynamicLayout.

https://github.com/picoe/Eto/wiki/DynamicLayout

– Dale

thanks, is there any phyton script too?
_Stefano

You are missing a self.Content = layout.

Just creating a layout is not enough, you need to put it somewhere so it actually can show up.

import rhinoscriptsyntax as rs
import Rhino.UI
import Eto.Drawing as drawing
import Eto.Forms as forms
commandname = “FindHole”

class SimpleEtoDialog(forms.Dialog):

def __init__(self):
    self.Title = "Sample Eto Dialog"
    self.ClientSize = drawing.Size(200, 200)
    self.Padding = drawing.Padding(5)
    self.Resizable = False
    layout = forms.DynamicLayout()
    self.content = layout
    
    ##it is not working either.... 4
    
    
    layout.Padding = drawing.Padding(5)
    layout.Spacing = drawing.Size(5, 5)
    layout.AddRow(forms.Label(Text ="i !"))
    layout.AddRow(forms.Label(Text ="am"))
    layout.AddRow(forms.Label(Text ="NOT"))
    layout.AddRow(forms.Label(Text ="WORKING!"))

################################################################################

Creating a dialog instance and displaying the dialog.

################################################################################
def TestSampleEtoDialog():
dialog = SimpleEtoDialog()
dialog.ShowModal(Rhino.UI.RhinoEtoApp.MainWindow)

################################################################################

Check to see if this file is being executed as the “main” python

script instead of being used as a module by some other python script

This allows us to use the module which ever way we want.

################################################################################
if name == “main”:
TestSampleEtoDialog()

You typoed Content…

it works! thanks…

Have fun with Eto.Forms (:

do you know more eto’s example beyond this one? https://developer.rhino3d.com/guides/rhinopython/eto-controls-python/#sample-dialogs

I have really used Eto only with F# and C#, but it should be pretty straightforward to learn from examples in those languages, then transform to information into Python versions.