Hide and show 'form' with eto python script. Help me

rhino
rhinopython
eto

(Xiix Xoox) #1

I make a button with eto python script. The mission of button is get text. I want when button click then ‘form’ be hide. When i get text succeed and press ‘Enter’ then ‘form’ comeback.
How can make like that.
Please help me


(Xiix Xoox) #2

Help me!


(Dale Fugier) #3

Hi @xiix.xoox,

This should do the trick.

import Rhino.UI
import Eto.Drawing as drawing
import Eto.Forms as forms

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

        button = forms.Button()
        button.Text = "Click Me!"
        button.Click += self.OnPushPickButton
        self.Content = button
        
    def OnPickPoint(self, sender, e):
        Rhino.Input.RhinoGet.GetPoint("Pick a point", True)
        
    def OnPushPickButton(self, sender, e):
        Rhino.UI.EtoExtensions.PushPickButton(self, self.OnPickPoint)
        
dialog = SimpleEtoDialog()
dialog.ShowModal(Rhino.UI.RhinoEtoApp.MainWindow)

– Dale


(Xiix Xoox) #4

Thank you!