Skip to content

Commit

Permalink
Added SampleEtoPushPickButtonDialog.py
Browse files Browse the repository at this point in the history
  • Loading branch information
dalefugier committed Sep 17, 2018
1 parent 4374a08 commit 22ea602
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions rhinopython/SampleEtoPushPickButtonDialog.py
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit 22ea602

Please sign in to comment.