Skip to content

Instantly share code, notes, and snippets.

@8bitgentleman
Last active January 17, 2017 18:52
Show Gist options
  • Save 8bitgentleman/3cd717927eed12ffbf4a388654b58f2e to your computer and use it in GitHub Desktop.
Save 8bitgentleman/3cd717927eed12ffbf4a388654b58f2e to your computer and use it in GitHub Desktop.
import scriptcontext
import rhinoscriptsyntax as rs
import clr
clr.AddReference("Eto")
clr.AddReference("Rhino.UI")
from Rhino.UI import *
from Eto.Forms import Form, Dialog, Label, TextBox, StackLayout, Orientation, Button, HorizontalAlignment, MessageBox, DropDown, CheckBox, TableLayout, StackLayoutItem, DynamicLayout, Control, Panel, Form
from Eto.Drawing import *
class CollapserControl(Panel):
def __init__(self, isCollapsed):
self.isCollapsed = isCollapsed
self.isExpanded = not self.isCollapsed
m_collapsableControl = Control()
def collapserControl(Control, content):
m_collapsableControl = content
Content = null
isCollapsed = true
return
def Collapse():
Content = null
isCollapsed = True
return
def Expand():
Content = null #m_collapsableControl
isCollapsed = False
return
class MainForm(Form):
def __init__(self):
container = DynamicLayout()
collapserButtons = StackLayout(Spacing = 5, Orientation = Orientation.Horizontal)
collapserButtons.Items.Add(Button(Text = "btn1"))
collapserButtons.Items.Add(Button(Text = "btn2"))
collapserButtons.Items.Add(Button(Text = "btn3"))
collapser = CollapserControl(collapserButtons)
collapse = Button(Text="^")
def collapse_click(sender,args):
if collapser.isCollapsed:
collapser.Expand()
else:
collapser.Collapse()
collapse.Click += collapse_click
container.AddRow(collapse)
container.AddRow(collapser)
Content = container
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment