I have a question about ETO forms. I want to be able to close a form, and the redraw it later. When I run this script it doesn't allow me to call drawForm() a second time. Looking at the ETO docs, I learned that if I close a form I can reopen a new one, but it doesn't allow me to reopen a form that has already been opened and closed beforehand. Are there any work arounds to this?
import Rhino
import rhinoscriptsyntax as rs
from Rhino.UI import *
from Eto.Forms import Form, CheckBox, TableRow, TableCell, Drawable, GroupBox, BorderType, Panel, DynamicLayout, VerticalAlignment, TableLayout, ColorPicker,Dialog, Label, TextBox, StackLayout, StackLayoutItem, Orientation, Button, HorizontalAlignment, MessageBox, ProgressBar, ImageView, TextAlignment
from Eto.Drawing import *
import scriptcontext
import os
dir = os.path.dirname(file)
Initialising form
initialForm = Dialogbool
initialForm.Title = "Automated House Design"
initialForm.Resizable = False
layout = TableLayout()
layout.Spacing = Size(5,5)
layout.Padding = Padding(10,10,10,10)
Defining textboxes, progress bars and buttons
progressBar = ProgressBar(Value = 0, MaxValue = 50)
addSelectedButton = Button(Text = "Add Selected to Favourites")
Defining checkboxes for images
checkbox1 = CheckBox()
checkbox2 = CheckBox()
checkbox3 = CheckBox()
checkbox4 = CheckBox()
checkbox5 = CheckBox()
checkbox6 = CheckBox()
favouritesArray = []
unwantedArray = []
Defining boxes for images
boxArray = []
box1 = ImageView()
box1.Image = Bitmap(os.path.join(dir, 'box.png'))
box2 = ImageView()
box2.Image = Bitmap(os.path.join(dir, 'box.png'))
box3 = ImageView()
box3.Image = Bitmap(os.path.join(dir, 'box.png'))
box4 = ImageView()
box4.Image = Bitmap(os.path.join(dir, 'box.png'))
box5 = ImageView()
box5.Image = Bitmap(os.path.join(dir, 'box.png'))
box6 = ImageView()
box6.Image = Bitmap(os.path.join(dir, 'box.png'))
def L(text):
return Label(Text = text, VerticalAlignment = VerticalAlignment.Center, TextAlignment = TextAlignment.Right)
def drawForm():
#Drawing objects to form
layout.Rows.Add(TableRow(TableCell(L("Please choose which houses you like"))))
layout.Rows.Add(TableRow(TableCell(box1), TableCell(box2), TableCell(box3)))
layout.Rows.Add(TableRow(TableCell(checkbox1), TableCell(checkbox2), TableCell(checkbox3)))
layout.Rows.Add(TableRow(TableCell(box4), TableCell(box5), TableCell(box6)))
layout.Rows.Add(TableRow(TableCell(checkbox4), TableCell(checkbox5), TableCell(checkbox6)))
layout.Rows.Add(TableRow(TableCell(addSelectedButton)))
layout.Rows.Add(TableRow(TableCell(progressBar)))
initialForm.Content = layout
initialForm.DefaultButton = addSelectedButton
result = initialForm.ShowModal(RhinoEtoApp.MainWindow)
return result
def formclose():
drawForm()
initialForm.Close()
MessageBox.Show(" close 1")
drawForm()
MessageBox.Show("close 2")
initialForm.Close()
formclose()