def initUI(self): #UI code print('init UI') # button1=System.Windows.Forms.Button() # button1.Location=System.Drawing.Point(5,10) # self.Controls.Add(button1) self.SuspendLayout() lay = Forms.FlowLayoutPanel() lay.FlowDirection = Forms.FlowDirection.LeftToRight lay.Location = Point(10, 10) lay.Size = Size(200, 300) lay.Text = 'TopToBottom' lay.SuspendLayout() tb1 = Forms.TextBox() tb1.Text = 'hello' tb2 = Forms.TextBox() tb2.Text = 'world' #tb2.Location=Point(0,20) # tb.Location=Drawing.Point(10,10) #tb1.Location=Point(10,10) lay.Controls.Add(tb1) lay.Controls.Add(tb2) self.Controls.Add(lay) lay.ResumeLayout(False) self.ResumeLayout(False)
def __init__(self, links): self.tableLayoutOverall = swf.TableLayoutPanel() self.labelLink = swf.Label() self.comboBoxLink = swf.ComboBox() self.flowLayoutPanelButtons = swf.FlowLayoutPanel() self.buttonSelect = swf.Button() self.buttonCancel = swf.Button() self.tableLayoutOverall.SuspendLayout() self.flowLayoutPanelButtons.SuspendLayout() self.SuspendLayout() # labelLink self.labelLink.Anchor = swf.AnchorStyles.Right self.labelLink.AutoSize = True self.labelLink.Location = sd.Point(25, 18) self.labelLink.Name = "labelLink" self.labelLink.Size = sd.Size(27, 13) self.labelLink.TabIndex = 0 self.labelLink.Text = "Link" # comboBoxLink self.comboBoxLink.Anchor = swf.AnchorStyles.Left | swf.AnchorStyles.Right self.comboBoxLink.FormattingEnabled = True self.comboBoxLink.Location = sd.Point(58, 14) self.comboBoxLink.Name = "comboBoxLink" self.comboBoxLink.Size = sd.Size(258, 21) self.comboBoxLink.TabIndex = 1 # buttonSelect self.buttonSelect.DialogResult = swf.DialogResult.OK self.buttonSelect.Location = sd.Point(149, 3) self.buttonSelect.Name = "buttonSelect" self.buttonSelect.Size = sd.Size(75, 23) self.buttonSelect.TabIndex = 0 self.buttonSelect.Text = "Select" self.buttonSelect.UseVisualStyleBackColor = True # buttonCancel self.buttonCancel.Anchor = swf.AnchorStyles.None self.buttonCancel.DialogResult = swf.DialogResult.Cancel self.buttonCancel.Location = sd.Point(230, 3) self.buttonCancel.Name = "buttonCancel" self.buttonCancel.Size = sd.Size(75, 23) self.buttonCancel.TabIndex = 1 self.buttonCancel.Text = "Cancel" self.buttonCancel.UseVisualStyleBackColor = True # flowLayoutPanelButtons self.flowLayoutPanelButtons.BackColor = sd.SystemColors.Control self.tableLayoutOverall.SetColumnSpan(self.flowLayoutPanelButtons, 2) self.flowLayoutPanelButtons.Controls.Add(self.buttonCancel) self.flowLayoutPanelButtons.Controls.Add(self.buttonSelect) self.flowLayoutPanelButtons.Dock = swf.DockStyle.Fill self.flowLayoutPanelButtons.FlowDirection = swf.FlowDirection.RightToLeft self.flowLayoutPanelButtons.Location = sd.Point(8, 48) self.flowLayoutPanelButtons.Name = "flowLayoutPanelButtons" self.flowLayoutPanelButtons.Size = sd.Size(308, 35) self.flowLayoutPanelButtons.TabIndex = 2 # tableLayoutOverall self.tableLayoutOverall.ColumnCount = 2 self.tableLayoutOverall.ColumnStyles.Add( swf.ColumnStyle(swf.SizeType.Absolute, 50)) self.tableLayoutOverall.ColumnStyles.Add(swf.ColumnStyle()) self.tableLayoutOverall.Controls.Add(self.labelLink, 0, 0) self.tableLayoutOverall.Controls.Add(self.comboBoxLink, 1, 0) self.tableLayoutOverall.Controls.Add(self.flowLayoutPanelButtons, 0, 1) self.tableLayoutOverall.Dock = swf.DockStyle.Fill self.tableLayoutOverall.Location = sd.Point(0, 0) self.tableLayoutOverall.Name = "tableLayoutOverall" self.tableLayoutOverall.Padding = swf.Padding(5) self.tableLayoutOverall.RowCount = 2 self.tableLayoutOverall.RowStyles.Add( swf.RowStyle(swf.SizeType.Percent, 50)) self.tableLayoutOverall.RowStyles.Add( swf.RowStyle(swf.SizeType.Percent, 50)) self.tableLayoutOverall.Size = sd.Size(324, 91) self.tableLayoutOverall.TabIndex = 0 # RoomSpaceCopyForm self.AcceptButton = self.buttonSelect self.AutoScaleDimensions = sd.SizeF(6, 13) self.AutoScaleMode = swf.AutoScaleMode.Font self.CancelButton = self.buttonCancel self.ClientSize = sd.Size(324, 91) self.Controls.Add(self.tableLayoutOverall) self.MaximizeBox = False self.MinimizeBox = False self.MinimumSize = sd.Size(340, 130) self.Name = "RoomSpaceCopyForm" self.Text = "RoomSpaceCopyForm" self.tableLayoutOverall.ResumeLayout(False) self.tableLayoutOverall.PerformLayout() self.flowLayoutPanelButtons.ResumeLayout(False) self.ResumeLayout(False) # Populate comboBox and preselec first item for link_title in links.keys(): self.comboBoxLink.Items.Add(link_title) self.comboBoxLink.SelectedIndex = 0