From 22ea602852d08a54e8b19bebf3caf442bfa5c986 Mon Sep 17 00:00:00 2001 From: Dale Fugier Date: Mon, 17 Sep 2018 14:09:37 -0700 Subject: [PATCH] Added SampleEtoPushPickButtonDialog.py --- rhinopython/SampleEtoPushPickButtonDialog.py | 45 ++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 rhinopython/SampleEtoPushPickButtonDialog.py diff --git a/rhinopython/SampleEtoPushPickButtonDialog.py b/rhinopython/SampleEtoPushPickButtonDialog.py new file mode 100644 index 00000000..6c9315e0 --- /dev/null +++ b/rhinopython/SampleEtoPushPickButtonDialog.py @@ -0,0 +1,45 @@ +################################################################################ +# SampleEtoPushPickButtonDialog.py +# Copyright (c) 2018 Robert McNeel & Associates. +# See License.md in the root of this repository for details. +################################################################################ +# Imports +import Rhino.UI +import Eto.Drawing as drawing +import Eto.Forms as forms + +class SampleEtoPushPickButtonDialog(forms.Dialog): + + def __init__(self): + self.Title = "Sample Eto PushPickButton 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) + + +################################################################################ +# Creating a dialog instance and displaying the dialog. +################################################################################ +def TestSampleEtoPushPickButtonDialog(): + dialog = SampleEtoPushPickButtonDialog() + 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__": + TestSampleEtoPushPickButtonDialog() \ No newline at end of file