def ShowInputBox(): """ <Script> <Author>AUG</Author> <Description>This script will open an input box for the user to define an integer</Description> </Script> """ if sys.platform != 'cli': import pythoncom pythoncom.CoInitialize() f.Text = 'Select Factor' f.Width = 300 f.Height = 60 tb.Text = value.ToString() tb.Dock = DockStyle.Left bt = Button() bt.Click += OnKeyPress bt.Text = "OK" bt.Dock = DockStyle.Right f.Controls.Add(tb) f.Controls.Add(bt) f.ShowDialog()
def __init__(self, watcher=None): # self.__watcher = watcher self.Text = "FileWatcher configuration" self.__table = TableLayoutPanel() self.MinimumSize = Size(520, 360) self.Size = Size(640, 360) self.MaximizeBox = False self.Icon = Icon("watcher.ico") p = Panel() p.Padding = Padding(10, 0, 10, 10) exitBut = Button(Text="E&xit") p.Height = exitBut.Height + 10 p.Controls.Add(exitBut) exitBut.Dock = DockStyle.Right p.Dock = DockStyle.Bottom def exit(s, e): self.Dispose() exitBut.Click += exit self.Controls.Add(p) self.Controls.Add(self.__table) label = Label(Text="Watch Directories") self.__table.Controls.Add(label) self.__list = ListBox() self.__list.Width = 500 self.__table.Dock = DockStyle.Fill try: for wd in watcher.controller.watchDirectories.itervalues(): self.__list.Items.Add(wd) except Exception, e: self.__list.Items.Add(str(e))
def __init__(self): self.Text = 'Select multiple parameters for deletion' button = Button() # Button created button.Text = "Delete Parameters" # with this name button.Dock = DockStyle.Bottom # it is docked to bottom of the form button.Click += self.OnClick # CLick event is rissent and uses OnClick function self.Controls.Add(button) # this control adds button name = ColumnHeader( ) # these 3 are column header names for 3 parameter properties I am going to use. -1 means longest value will be used for length name.Text = 'Parameter' name.Width = -1 paramgr = ColumnHeader() paramgr.Text = 'Parameter Group' paramgr.Width = -1 parfor = ColumnHeader() parfor.Text = 'Parameter Formula' parfor.Width = 140 self.SuspendLayout() # not sure if this must be used, but it works lv = ListView() # this makes a Listview lv.Parent = self lv.FullRowSelect = False lv.CheckBoxes = True lv.GridLines = True lv.AllowColumnReorder = True lv.View = View.Details lv.Columns.AddRange( (name, paramgr, parfor)) # columns have been created for column headers above lv.ColumnClick += self.OnColumnClick # ColumnCLick event enables sorting from OnColumnClick function for par in paramsList: # this adds parameter properties to listview columns asn subitems item = ListViewItem() item.Text = par.Definition.Name # first item is parameter name item.SubItems.Add(par.Definition.ParameterGroup.ToString() ) # second is parameter group to string if par.Formula: # if formula exists at all item.SubItems.Add(par.Formula.ToString()) # show it as string else: # if it does not exist item.SubItems.Add("-") # add anything lv.Items.Add(item) # add item to ListViewItems lv.Dock = DockStyle.Fill # fill in Form with this lisview (buttin is docked to bottom as seen above) lv.ItemCheck += self.OnSelected # ItemCheck event is called with OnSelected function self.ResumeLayout() # not sure if this must be used, but it works self.Size = Size(450, 400) # dimension of the Form self.CenterToScreen() # Form is being centered to screen
def initialiseButtons(self): buttonPanel = Panel() buttonPanel.Height = 23 buttonPanel.Dock = DockStyle.Bottom buttonPanel.Width = 170 acceptButton = Button() acceptButton.Text = "OK" acceptButton.DialogResult = DialogResult.OK acceptButton.Width = 75 acceptButton.Dock = DockStyle.Left self.AcceptButton = acceptButton buttonPanel.Controls.Add(acceptButton) cancelButton = Button() cancelButton.Text = "Cancel" cancelButton.DialogResult = DialogResult.Cancel cancelButton.Width = 75 cancelButton.Dock = DockStyle.Right self.CancelButton = cancelButton buttonPanel.Controls.Add(cancelButton) self.Controls.Add(buttonPanel)
overlay = InkOverlay(pnl) overlay.Enabled = True tb = TextBox() tb.Font = Font('serif', 20) tb.Multiline = True sc = SplitContainer() sc.SplitterWidth = 10 sc.Orientation = Orientation.Horizontal # Layout f.Width = 600 f.Height = 400 sc.Dock = DockStyle.Fill btn.Dock = DockStyle.Top tb.Dock = DockStyle.Fill pnl.Dock = DockStyle.Fill f.Controls.Add(sc) sc.Panel1.Controls.Add(btn) sc.Panel1.Controls.Add(pnl) sc.Panel2.Controls.Add(tb) # Event handling def OnStroke(sender, args): tb.Text = overlay.Ink.Strokes.ToString() overlay.Stroke += OnStroke def OnClick(sender, args): overlay.Ink.DeleteStrokes() pnl.Refresh()
window.Controls.Add(LOAD_AREA) MUTATION_AREA = Panel() MUTATION_AREA.Width = LOAD_AREA.Width MUTATION_AREA.Height = LOAD_AREA.Height #MUTATION_AREA.BorderStyle = BorderStyle.FixedSingle MUTATION_AREA.Dock = DockStyle.Fill #MUTATION_AREA.BackColor = Color.Red window.Controls.Add(MUTATION_AREA) ######################################### # LOAD FILE CONTROLS ################### LOAD_BUTTON = Button() LOAD_BUTTON.Text = "Load" LOAD_BUTTON.Dock = DockStyle.Right LOAD_TEXTBOX = Formbox("Path to file...") LOAD_TEXTBOX.Dock = DockStyle.Left LOAD_TEXTBOX.Width = LOAD_AREA.Width - LOAD_BUTTON.Width LOAD_AREA.Controls.Add(LOAD_BUTTON) LOAD_AREA.Controls.Add(LOAD_TEXTBOX) ######################################### # MUTATION AREA CONTROLS ############### EXPLORER_VISIBLE_INFORMATION_AREA = Panel() EXPLORER_VISIBLE_INFORMATION_AREA.Height = MUTATION_AREA.Height * 6 / 7 EXPLORER_VISIBLE_INFORMATION_AREA.Dock = DockStyle.Top UNDERLYING_INFORMATION_AREA = Panel()