Trying to make a form using the Eto framework in Python:
(Please don’t mind the colors…, these are only there two differentiate between the two blocks.)
It exists of two blocks, the first narrower then the second.
The first block has a label and a combobox.
The second has a textarea over the whole width, and below that a button (‘Export to…’) aligned to the right of that.
I cannot get the widths correct.
- Is it even possible to make blocks of a different width?
- Can I set the width of an element? (Like buttons.)
(A not so important question: can I color the background of blocks?)
Thanks!
My code so far:
import System
import Rhino.UI
import Eto.Drawing as drawing
import Eto.Forms as forms
class MyDialog(forms.Dialog):
def __init__(self):
self.Title = 'My Dialog'
self.Padding = drawing.Padding(10)
self.Resizable = False
self.labelKeys = forms.Label(Text = 'ProdRef:\nProduct:\nOndermeubel:')
self.labelKeys.Size = drawing.Size(-1,-1)
self.labelValues = forms.Label(Text = 'Modulo 2 Kast\nOndermeubel\nModulo 2')
self.checkLayers = forms.CheckBox(Text = ' from layers')
self.checkLayers.Checked = True
self.labelProps = forms.Label(Text = 'Properties from ')
self.comboProps = forms.ComboBox()
self.comboProps.DataStore = ['Layers', 'Object info']
self.comboProps.SelectedIndex = 0
self.textareaResult= forms.TextArea()
self.textareaResult.Size = drawing.Size(770, 400)
self.exportButton = forms.Button(Text = 'Export to ...')
layout = forms.DynamicLayout()
layout.DefaultSpacing = drawing.Size(5, 5)
layout.Padding = drawing.Padding(10)
layout.BeginVertical()
layout.AddRow(self.labelKeys, self.labelValues)
layout.AddRow(None, self.checkLayers)
layout.EndVertical()
layout.BeginVertical()
layout.AddRow(self.labelProps, self.comboProps)
layout.EndVertical()
layout.BeginVertical()
layout.AddRow(self.textareaResult)
layout.AddRow(self.exportButton)
layout.EndVertical()
self.Content = layout
def TestMyDialog():
dialog = MyDialog()
dialog.ShowModal(Rhino.UI.RhinoEtoApp.MainWindow)
if __name__ == "__main__":
TestMyDialog()