-
Notifications
You must be signed in to change notification settings - Fork 335
/
Copy pathSampleEtoPushPickButtonDialog.py
45 lines (36 loc) · 1.79 KB
/
SampleEtoPushPickButtonDialog.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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()