def __init__(self): self.m_apiInstance = None self.m_disp = None self.m_handler = None self.m_disposed = False #self.m_lock = Object() self.m_req = None self.m_ps = None self.Text = 'DavTrader' self.Name = 'DavTrader' self.STORE = 'hdtest3.h5' # Note: another option is to keep the actual file open self.CACHE = {} self.loginBtn = Button() self.loginBtn.Name = 'connect' self.loginBtn.Text = 'Connect' self.loginBtn.Location = Point(10, 10) self.loginBtn.Click += self.loginBtn_eventhandler self.DisposeBtn = Button() self.DisposeBtn.Name = 'disconnect' self.DisposeBtn.Text = 'Disconnect' self.DisposeBtn.Location = Point(100, 10) self.DisposeBtn.Click += self.DisposeBtn_eventhandler self.statusbar = StatusBar() self.statusbar.Parent = self self.Controls.Add(self.loginBtn) self.Controls.Add(self.DisposeBtn)
def __init__(self, curveId): offset = 10 self.Text = "Annotate Curve" crvlabel = Label(Text="Curve ID = " + str(curveId), AutoSize=True) self.Controls.Add(crvlabel) width = crvlabel.Right pt = Point(crvlabel.Left, crvlabel.Bottom + offset) labelstart = Label(Text="Text at start", AutoSize=True) labelstart.Location = pt self.Controls.Add(labelstart) pt.X = labelstart.Right + offset inputstart = TextBox(Text="Start") inputstart.Location = pt self.Controls.Add(inputstart) if (inputstart.Right > width): width = inputstart.Right self.m_inputstart = inputstart pt.X = labelstart.Left pt.Y = labelstart.Bottom + offset * 3 buttonApply = Button(Text="Apply", DialogResult=DialogResult.OK) buttonApply.Location = pt self.Controls.Add(buttonApply) pt.X = buttonApply.Right + offset buttonCancel = Button(Text="Cancel", DialogResult=DialogResult.Cancel) buttonCancel.Location = pt self.Controls.Add(buttonCancel) if (buttonCancel.Right > width): width = buttonCancel.Right self.ClientSize = Size(width, buttonCancel.Bottom) self.AcceptButton = buttonApply self.CancelButton = buttonCancel
def init(self): # table table = make_table('main', False) table.Size = Size(580, 700) table.Location = Point(10, 10) table.ColumnCount = 2 table.Columns[0].Name = 'Key' table.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable table.Columns[0].ReadOnly = True table.Columns[0].DefaultCellStyle.SelectionBackColor = Color.FromArgb(238, 238, 238) table.Columns[0].DefaultCellStyle.BackColor = Color.FromArgb(238, 238, 238) table.Columns[1].Name = 'Value' table.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable keys = sorted(self.settings.keys()) for key in keys: table.Rows.Add(key, self.settings[key]) self.table = table # buttons ok = Button() ok.Text = 'OK' ok.DialogResult = DialogResult.OK cancel = Button() cancel.Text = 'Cancel' cancel.DialogResult = DialogResult.Cancel buttons = FlowLayoutPanel() buttons.FlowDirection = FlowDirection.RightToLeft # buttons.BorderStyle = BorderStyle.None buttons.Controls.Add(cancel) buttons.Controls.Add(ok) buttons.Size = Size(580, 30) buttons.Location = Point(10, 720) # layout self.ClientSize = Size(600, 800) self.Controls.Add(table) self.Controls.Add(buttons)
def __init__(self): """ComboBoxSample class init function.""" # setup title self.Text = "ComboBox Style Changes" self.Width = 400 self.Height = 500 self.is_x10 = False # setup buttons self.dropdownlistbutton = Button() self.dropdownlistbutton.Text = "DropDownList" self.dropdownlistbutton.Width = 110 self.dropdownlistbutton.Location = Point(5, 5) self.dropdownlistbutton.Click += self.change_to_dropdownlist self.dropdownbutton = Button() self.dropdownbutton.Text = "DropDown" self.dropdownbutton.Width = 110 self.dropdownbutton.Location = Point(135, 5) self.dropdownbutton.Click += self.change_to_dropdown self.dropdownbutton.BackColor = Color.Lime self.simplebutton = Button() self.simplebutton.Text = "Simple" self.simplebutton.Width = 110 self.simplebutton.Location = Point(265, 5) self.simplebutton.Click += self.change_to_simple self.xtenbutton = Button() self.xtenbutton.Text = "Toggle x10" self.xtenbutton.Width = 110 self.xtenbutton.Location = Point(5, 55) self.xtenbutton.Click += self.toggle_x10 # setup label self.label = Label() self.label.Text = "You select " self.label.Location = Point(5, 100) # setup combobox self.combobox = ComboBox() self.combobox.DropDownStyle = ComboBoxStyle.DropDown self.combobox.SelectionChangeCommitted += self.select self.combobox.TextChanged += self.select self.combobox.Width = 390 self.combobox.Location = Point(0, 130) # add items in ComboBox for i in range(10): self.combobox.Items.Add(str(i)) self.combobox.SelectedIndex = 1 # add controls self.Controls.Add(self.combobox) self.Controls.Add(self.label) self.Controls.Add(self.dropdownlistbutton) self.Controls.Add(self.dropdownbutton) self.Controls.Add(self.simplebutton) self.Controls.Add(self.xtenbutton)
def __init__(self): self.Title="Timer" self.timer1=Timer() self.timer1.Interval=1000 self.timer1.Tick+=self.timer1_tick label1=Label() label1.AutoSize=True label1.Location=Point(41,22) label1.Text="00:00:00" label1.Font=Font("MS UI Gothic",24.0,FontStyle.Regular) self.label1=label1 self.Controls.Add(self.label1) clientwidth=255 b1=Button() b1.Location=Point((clientwidth-b1.Width*2)/3,68) b1.Text="Click" b1.Click+=self.start_Click self.Controls.Add(b1) b2=Button() b2.Location=Point((clientwidth-b1.Width*2)*2/3+b1.Width,68) b2.Text="Stop" b2.Click+=self.stop_Click self.Controls.Add(b2) self.ClientSize=Size(clientwidth,103) self.Text="Stop Watch" self.StartPosition=FormStartPosition.CenterScreen
def setupOKButtons(self): self.OKbuttonPanel = self.newPanel(0, 600) okButton = Button() okButton.Text = "OK" okButton.Location = Point(25, 50) self.AcceptButton = okButton okButton.Click += self.okClicked cancelButton = Button() cancelButton.Text = "Cancel" cancelButton.Location = Point(okButton.Left + okButton.Width + 10, okButton.Top) self.CancelButton = cancelButton cancelButton.Click += self.cancelClicked self.Status = Label() self.Status.Text = "" self.Status.Location = Point(200, 50) self.Status.AutoSize = True self.Status.Font = Font("Arial", 12, FontStyle.Bold) self.Status.ForeColor = Color.Black self.OKbuttonPanel.Controls.Add(okButton) self.OKbuttonPanel.Controls.Add(cancelButton) self.OKbuttonPanel.Controls.Add(self.Status) for CT in patient.Examinations: self.scancombo.Items.Add(CT.Name) try: self.scancombo.SelectedIndex = self.scancombo.FindStringExact( "CT 1") except: self.scancombo.SelectedIndex = 0
def add_button_panel(self): # create button panel self.button_panel = FlowLayoutPanel() self.button_panel.Parent = self.dialog_window self.button_panel.BackColor = BUTTON_PANEL_COLOR self.button_panel.Dock = DockStyle.Bottom self.button_panel.Padding = Padding(10, 0, 10, 10) self.button_panel.WrapContents = False self.button_panel.AutoSize = True self.button_panel.Font = BODY_FONT self.button_panel.FlowDirection = FlowDirection.LeftToRight # add yes button self.yes_button = Button() self.yes_button.Parent = self.button_panel self.yes_button.Text = "Yes, Stop the Stimulation" self.yes_button.Click += self.on_yes_button_click self.yes_button.BackColor = BUTTON_COLOR self.yes_button.AutoSize = True # add cancel button self.cancel_button = Button() self.cancel_button.Parent = self.button_panel self.cancel_button.Text = "Cancel" self.cancel_button.Click += self.on_cancel_button_click self.cancel_button.BackColor = BUTTON_COLOR self.cancel_button.Font = ERROR_FONT self.cancel_button.AutoSize = True # cancel button is activated when user presses Enter self.dialog_window.AcceptButton = self.cancel_button
def __init__(self, itemlist): height = len(itemlist) * 17 self.Text = "Select the categories to export" self.Size = Size(300, height + 80) self.check = CheckedListBox() self.check.Parent = self self.check.Location = Point(5, 5) self.check.Size = Size(270, height) # load the list of relevant categories found in the project list_items = List[Object](itemlist) self.check.Items.AddRange(list_items.ToArray()) self.check.CheckOnClick = True # set checked by default for i in range(len(itemlist)): self.check.SetItemChecked(i, True) okay = Button() okay.Parent = self okay.Text = 'OK' okay.Location = Point(50, height + 10) okay.Width = 140 okay.Click += self.onValidate cancel = Button() cancel.Parent = self cancel.Text = 'Cancel' cancel.Location = Point(okay.Right, height + 10) cancel.Click += self.onCancel self.CenterToScreen()
def __init__(self, plan): self.Text = "Choose the apropriate ROI" structure_set = plan.GetStructureSet() self.roi_names = sorted([rg.OfRoi.Name for rg in structure_set.RoiGeometries if rg.PrimaryShape != None]) self.roi_colors = [rg.OfRoi.Color for rg in structure_set.RoiGeometries if rg.PrimaryShape != None] self.Width = 160*4 + 50 self.Height = 55*int(ceil(len(self.roi_names)/4.)) + 150 print self.roi_colors self.setupCheckButtons() # Add button to press OK and close the Form button = Button() button.Text = "OK" button.AutoSize = True button.Location = Point(self.Width - 105, self.Height - 100) button.Click += self.ok_button_clicked # Add button to press Stop and close the Form button2 = Button() button2.Text = "Stop" button2.AutoSize = True button2.Location = Point(self.Width - 210, self.Height - 100) button2.Click += self.stop_button_clicked self.Controls.Add(button) self.Controls.Add(button2) self.Controls.Add(self.checkPanel)
def add_save_button_panel(self): # create save button panel self.save_button_panel = FlowLayoutPanel() self.save_button_panel.Parent = self.dialog_window self.save_button_panel.BackColor = BUTTON_PANEL_COLOR self.save_button_panel.Dock = DockStyle.Bottom self.save_button_panel.Padding = Padding(10) self.save_button_panel.WrapContents = False self.save_button_panel.AutoSize = True self.save_button_panel.Font = BODY_FONT # add save button self.save_button = Button() self.save_button.Parent = self.save_button_panel self.save_button.Text = "Save" self.save_button.Click += self.on_save_button_click self.save_button.BackColor = BUTTON_COLOR self.save_button.AutoSize = True # save button is activated when user presses Enter self.dialog_window.AcceptButton = self.save_button # add close button self.close_button = Button() self.close_button.Parent = self.save_button_panel self.close_button.Text = "Close" self.close_button.DialogResult = DialogResult.Cancel self.close_button.BackColor = BUTTON_COLOR self.close_button.AutoSize = True
def __init__(self, chracters): self.existingchracters = chracters self.TextBox = TextBox() self.TextBox.Size = Size(250, 20) self.TextBox.Location = Point(15, 12) self.TextBox.TabIndex = 1 self.TextBox.MaxLength = 1 self.OK = Button() self.OK.Text = "OK" self.OK.Size = Size(75, 23) self.OK.Location = Point(109, 38) self.OK.DialogResult = DialogResult.OK self.OK.Click += self.CheckTextBox self.Cancel = Button() self.Cancel.Size = Size(75, 23) self.Cancel.Text = "Cancel" self.Cancel.Location = Point(190, 38) self.Cancel.DialogResult = DialogResult.Cancel self.Size = Size(300, 100) self.Text = "Please enter the character" self.Controls.Add(self.OK) self.Controls.Add(self.Cancel) self.Controls.Add(self.TextBox) self.AcceptButton = self.OK self.CancelButton = self.Cancel self.FormBorderStyle = FormBorderStyle.FixedDialog self.StartPosition = FormStartPosition.CenterParent self.Icon = System.Drawing.Icon(ICON) self.ActiveControl = self.TextBox
def __init__(self): self.Text = "SolverStudio: NEOS Warning" self.FormBorderStyle = FormBorderStyle.FixedDialog self.Height = 235 self.Width = 310 # self.Warning = Label() # self.Warning.Text = "Models solved using via NEOS will be available in the public domain for perpetuity." # self.Warning.Location = Point(10,10) # self.Warning.Height = 30 # self.Warning.Width = 380 self.myOK = Button() self.myOK.Text = "Continue" self.myOK.Width = 100 self.myOK.Location = Point(self.Width / 2 - self.myOK.Width - 30, self.Height - 65) self.myOK.Click += self.AddChoice self.myCancel = Button() self.myCancel.Text = "Cancel" self.myCancel.Width = 100 self.myCancel.Location = Point(self.Width / 2 + 30, self.Height - 65) self.check1 = CheckBox() self.check1.Text = "Never show NEOS warnings again." self.check1.Location = Point(12, 80) self.check1.Width = 250 self.check1.Height = 130 self.link1 = LinkLabel() self.link1.Location = Point(10, 10) self.link1.Width = self.Width - 15 self.link1.Height = 120 self.link1.LinkClicked += self.OpenTCs self.link1.VisitedLinkColor = Color.Blue self.link1.LinkBehavior = LinkBehavior.HoverUnderline self.link1.LinkColor = Color.Navy msg = "By using NEOS via SolverStudio you agree to the NEOS-Server terms and conditions, and accept that your model will become publicly available.\n\n" msg += "Some solvers require an email address, which you can set using the GAMS menu. " email = SolverStudio.GetRegistrySetting("NEOS", "Email", "") if email == "": msg += "You have not provided an email address, and so some solvers may fail." else: msg += "Your email address (" + email + ") will be sent to NEOS." # msg += "\n\nContinue?" self.link1.Text = msg self.link1.LinkArea = LinkArea(60, 20) self.AcceptButton = self.myOK self.CancelButton = self.myCancel self.Controls.Add(self.myOK) self.Controls.Add(self.myCancel) self.Controls.Add(self.link1) # self.Controls.Add(self.Warning) self.Controls.Add(self.check1) # self.CenterToScreen() self.StartPosition = FormStartPosition.CenterParent
def showBox(self): ''' set the remaining box controls and launch ''' self.buttonpanel = Panel() self.buttonpanel.Parent = self self.buttonpanel.Location = Point(0, self.panel.Bottom) self.buttonpanel.Size = Size(Fconfig.smwidth, 2 * Fconfig.unitline) self.buttonpanel.Dock = DockStyle.Bottom self.warning = Label() self.warning.Parent = self.buttonpanel self.warning.Location = Point(Fconfig.margin, 0) self.warning.Size = Size(Fconfig.smwidth, Fconfig.unitline) self.warning.Font = Font(Fconfig.basefont, Fconfig.sizefont, FontStyle.Bold) self.warning.ForeColor = Color.Coral self.warning.TextAlign = ContentAlignment.MiddleCenter okay = Button() okay.Parent = self.buttonpanel okay.Text = Fconfig.buttonOK okay.Location = Point(50, Fconfig.unitline) okay.Width = 140 okay.Click += self.onValidate okay.Anchor = AnchorStyles.Right cancel = Button() cancel.Text = Fconfig.buttonCANCEL cancel.Parent = self.buttonpanel cancel.Location = Point(okay.Right, Fconfig.unitline) cancel.Click += self.onCancel cancel.Anchor = AnchorStyles.Right self.Width = Fconfig.width self.Height = self.panel.Bottom + 105 self.CenterToScreen() ModeDBG.say('\npanel top :{0}, bottom :{1}'.format( self.panel.Top, self.panel.Bottom)) ModeDBG.say('\n\nPanel loaded with {0} items\n'.format( len(self.panelparams))) # Display the form try: if Application.MessageLoop: TaskDialog.Show('UserForm', 'Another window is running...') else: Application.Run(self) except: TaskDialog.Show('UserForm', 'Loading failed...')
def __init__(self): self.Text = "SolverStudio NEOS Email Address" self.FormBorderStyle = FormBorderStyle.FixedDialog self.Height= 140 self.Width = 460 self.label = Label() self.label.Text = "Some commercial solvers on NEOS, such as CPLEX, require a valid email address. Please enter the Email address, if any, you wish to send to NEOS when you solve:" self.label.Location = Point(10,10) self.label.Height = 35 self.label.Width = 430 self.KeyText = TextBox() self.KeyText.Location = Point(10,46) self.KeyText.Width = 430 self.KeyText.Height = 20 self.KeyText.Text = SolverStudio.GetRegistrySetting("NEOS","Email","") self.KeyText.AcceptsReturn = False; self.bOK=Button() self.bOK.Text = "OK" self.bOK.Location = Point(270,76) # self.bOK.Width = 100 self.bOK.Click += self.SetEmail self.link1 = LinkLabel() self.link1.Location = Point(10, 78) self.link1.Width = 250 self.link1.Height = 40 self.link1.LinkClicked += self.OpenTCs self.link1.VisitedLinkColor = Color.Blue; self.link1.LinkBehavior = LinkBehavior.HoverUnderline; self.link1.LinkColor = Color.Navy; self.link1.Text = "View NEOS terms and conditions" self.link1.LinkArea = LinkArea(5,25) self.bCancel=Button() self.bCancel.Text = "Cancel" self.bCancel.Location = Point(363,76) self.AcceptButton = self.bOK self.CancelButton = self.bCancel self.Controls.Add(self.label) self.Controls.Add(self.KeyText) # Add first to get focus self.Controls.Add(self.link1) self.Controls.Add(self.bOK) self.Controls.Add(self.bCancel) self.CenterToScreen()
def setupPanel2(self): self.panel2 = Panel() # self.panel2.Text = "Panel" self.panel2.Width = self.Width self.panel2.Height = 120 self.panel2.Location = Point(0, 120) self.panel2.BorderStyle = BorderStyle.FixedSingle self.p2title1 = Label() self.p2title1.Text = "Create Lumped Port" self.p2title1.Location = Point(25, 22) self.p2title1.Height = 25 self.p2title1.AutoSize = True self.p2label1 = Label() self.p2label1.Text = "Ground Metal Name: " self.p2label1.Location = Point(25, 50) self.p2label1.Height = 25 self.p2label1.Width = 150 self.p2button1 = Button() self.p2button1.Text = 'Create' self.p2button1.Location = Point(25, 75) self.p2button1.Width = 100 self.p2button1.Click += self.p2update self.p2button2 = Button() self.p2button2.Text = 'Reset' self.p2button2.Location = Point(180, 75) self.p2button2.Width = 100 self.p2button2.Click += self.p2reset self.p2list1 = ComboBox() self.p2list1.Text = '——Select' self.p2list1.Location = Point(180, 47) self.p2list1.Width = 100 self.p2list1.Height = 35 self.DropDownHeight = 50 self.p2list1.Click += self.p2listUpdate self.AcceptButton = self.p2button1 self.CancelButton = self.p2button2 self.panel2.Controls.Add(self.p2title1) self.panel2.Controls.Add(self.p2label1) self.panel2.Controls.Add(self.p2button1) self.panel2.Controls.Add(self.p2button2) self.panel2.Controls.Add(self.p2list1)
def __init__(self): self.Text = "SolverStudio" self.FormBorderStyle = FormBorderStyle.FixedDialog self.Height = 360 self.Width = 370 self.label = Label() self.label.Text = "" self.label.Location = Point(10, 10) self.label.Height = 20 self.label.Width = 200 self.bOK = Button() self.bOK.Text = "OK" self.bOK.Location = Point(150, 300) self.bOK.Click += self.OK self.Results = TextBox() self.Results.Multiline = True self.Results.ScrollBars = ScrollBars.Vertical self.Results.Location = Point(10, 40) self.Results.Width = 350 self.Results.Height = 250 self.AcceptButton = self.bOK self.Controls.Add(self.label) self.Controls.Add(self.bOK) self.Controls.Add(self.Results) self.CenterToScreen()
def __init__(self): self.Text = "SolverStudio" self.FormBorderStyle = FormBorderStyle.FixedDialog self.Height = 150 self.Width = 400 self.label1 = Label() self.label1.Text = "Pyomo is not installed by default in SolverStudio. You should install it yourself from the link below.\n\nBe sure to add the location of 'pyomo.exe' (usually '\\PythonXY\\Scripts') to the system path environment variable." self.label1.Location = Point(10, 10) self.label1.Height = 75 self.label1.Width = 380 self.myOK = Button() self.myOK.Text = "OK" self.myOK.Location = Point(310, 90) self.myOK.Click += self.CloseForm self.link1 = LinkLabel() self.link1.Location = Point(10, 95) self.link1.Width = 380 self.link1.Height = 20 self.link1.LinkClicked += VisitPYOMODownloadPage self.link1.VisitedLinkColor = Color.Blue self.link1.LinkBehavior = LinkBehavior.HoverUnderline self.link1.LinkColor = Color.Navy self.link1.Text = 'http://www.pyomo.org/installation/' self.link1.LinkArea = LinkArea(0, 49) self.AcceptButton = self.myOK self.Controls.Add(self.myOK) self.Controls.Add(self.link1) self.Controls.Add(self.label1) self.CenterToScreen()
def __init__(self): """ProgressBarSample class init function.""" # setup title self.Text = "ProgressBar control" self.Width = 260 self.Height = 100 # setup label self.label = Label() self.label.Text = "It is %d percent of 100%%" % 0 self.label.Width = 150 self.label.Location = Point(0, 0) # setup button self.button = Button() self.button.Text = "Click" self.button.Location = Point(170, 0) self.button.Click += self.start_progress # setup progressbar self.progressbar = ProgressBar() self.progressbar.Width = 250 self.progressbar.Visible = True self.progressbar.Minimum = 0 self.progressbar.Maximum = 100 self.progressbar.Value = 0 self.progressbar.Step = 20 self.progressbar.Location = Point(0, 50) # add controls self.Controls.Add(self.label) self.Controls.Add(self.button) self.Controls.Add(self.progressbar)
def __init__(self): self.Size = Size(200, 200) self.FormBorderStyle = FormBorderStyle.Sizable self._btn = Button() self._btn.Parent = self self._btn.Location = Point(0, 0) self._btn.Size = Size(20, 20)
def _add_buttons(self): ok = Button() ok.Text = 'OK' ok.DialogResult = DialogResult.OK cancel = Button() cancel.Text = 'Cancel' cancel.DialogResult = DialogResult.Cancel self.buttons = FlowLayoutPanel() self.buttons.FlowDirection = FlowDirection.RightToLeft self.buttons.BorderStyle = BorderStyle.None self.buttons.Controls.Add(cancel) self.buttons.Controls.Add(ok) self.buttons.Size = Size(580, 30) self.buttons.Location = Point(10, 720) self.ClientSize = Size(600, 800) self.Controls.Add(self.buttons)
def create_fast_button(self,buttonName,buttonHorizontalPosition,buttonVerticalPosition): self.fastButtonList[buttonName] = Button() self.fastButtonList[buttonName].Text=buttonName self.fastButtonList[buttonName].Location=Point(buttonHorizontalPosition,buttonVerticalPosition) #self.fastButtonList[buttonName].Click+=self.set_focus_on_edit_window self.fastButtonList[buttonName].Click+=self.fast_button_clicked self.Controls.Add(self.fastButtonList[buttonName])
def __init__(self, items): self.exEvent = None self.Width = 360 self.Height = 140 self.combo_box = ComboBox() self.combo_box.Width = 300 self.combo_box.Location = Point(20, 30) items = list(items) items.sort() for i in items: self.combo_box.Items.Add(i) self.combo_box.SelectedIndex = 0 self.label = Label() self.label.Text = "Выберете лист на который нужно добавить текущий вид" self.label.Width = 400 self.label.Location = Point(20, 10) self.button = Button() self.button.Width = 300 self.button.Text = "Расположить" self.button.Location = Point(20, 60) self.button.Click += self.run self.Controls.Add(self.combo_box) self.Controls.Add(self.label) self.Controls.Add(self.button)
def __init__(self, contents): self.Contents = contents self.BackColor = Color.FromArgb(25, 25, 25) self.ForeColor = Color.FromArgb(231, 231, 231) self.Size = Size(500, 400) self.Text = '{0} - v{1}'.format(self.ScriptName, self.CurVer) self.DataGridSetup() self.cbHide = CheckBox() self.cbHide.Text = 'Hide' self.cbHide.Checked = True self.cbHide.BackColor = Color.FromArgb(25, 25, 25) self.cbHide.Location = Point(342, 326) self.cbHide.Size = Size(50, 30) self.btnGet = Button() self.btnGet.Text = 'Get' self.btnGet.BackColor = Color.FromArgb(50, 50, 50) self.btnGet.Location = Point(422, 324) self.btnGet.Size = Size(50, 30) self.btnGet.FlatStyle = FlatStyle.Flat self.btnGet.FlatAppearance.BorderSize = 1 self.btnGet.Click += self.btnGetPressed self.Controls.Add(self.DataGrid) self.Controls.Add(self.cbHide) self.Controls.Add(self.btnGet)
def setupPanel2(self): self.panel2 = Panel() self.panel2.Text = "Change_unit Panel" self.panel2.Width = self.Width self.panel2.Height = 50 self.panel2.Location = Point(0, 0) self.panel2.BorderStyle = BorderStyle.FixedSingle self.label3 = Label() self.label3.Text = "设置视图单位:" self.label3.Location = Point(25, 15) self.label3.Height = 15 self.label3.Width = 100 self.textbox3 = TextBox() self.textbox3.Text = "um" self.textbox3.Location = Point(125, 12) self.textbox3.Width = 60 self.button3 = Button() self.button3.Text = 'ok' self.button3.Location = Point(200, 10) self.button3.Width = 40 self.button3.Click += self.c_unit self.panel2.Controls.Add(self.label3) self.panel2.Controls.Add(self.textbox3) self.panel2.Controls.Add(self.button3)
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, plan): # Set the size of the form self.Size = Size(500, 200) # Set title of the form self.Text = 'Approximate fiducial location' # Add a label label = Label() label.Text = 'Type the approximate fiducial location in mm' label.Location = Point(15, 15) label.AutoSize = True self.Controls.Add(label) # Add a TextBox self.textbox = TextBox() self.textbox.Location = Point(15, 60) self.textbox.Width = 150 self.Controls.Add(self.textbox) # Add button to press OK and close the form button = Button() button.Text = 'OK' button.AutoSize = True button.Location = Point(15, 100) button.Click += self.ok_button_clicked self.Controls.Add(button)
def __init__(self): self.m_testport = 'COM3' #: Port on test system self.m_test_meter = "300001162" #: Test V4 meter ekm_set_log(ekm_print_log) print "\n****\nInitializing v3 and v4 for db test" self.Text = 'Sample EKM Iron Python App' self.label = Label() self.label.Text = "0.0" self.label.Location = Point(50, 50) self.label.Height = 30 self.label.Width = 200 self.count = 0 button = Button() button.Text = "Read Meter: " + self.m_test_meter button.Location = Point(50, 100) button.Width = 180 button.Click += self.buttonPressed self.Controls.Add(self.label) self.Controls.Add(button)
def __init__(self): """SplitterSample class init function.""" # set window title self.Text = "Vertical Splitter" # Create TreeView, Button, and Splitter controls. self.treeView1 = TreeView() self.button1 = Button() self.splitter1 = Splitter() # Set the TreeView control to dock to the left side of the form. self.treeView1.Dock = DockStyle.Left # Set the Splitter to dock to the left side of the TreeView control. self.splitter1.Dock = DockStyle.Left # Set the minimum size the Button control can be sized to. self.splitter1.MinExtra = 100 # Set the minimum size the TreeView control can be sized to. self.splitter1.MinSize = 75 # Set the Button control to fill the remaining space on the form. self.button1.Dock = DockStyle.Fill # Add nodes to the TreeView self.treeView1.Nodes.Add("TreeView Node") self.treeView1.Nodes.Add("Another Node") # Give the button some text self.button1.Text = "Right Side" # Add the controls in reverse order to the form to ensure proper # location. array_Control = System.Array[Control] self.Controls.AddRange( array_Control((self.button1, self.splitter1, self.treeView1)))
def __init__(self, title, author): # Create the form self.Name = "Create Window" self.Text = title self.Size = Size(500, 150) self.CenterToScreen() self.value = "" # Create label for input title labelDiv = Label(Text=author + ":") labelDiv.Parent = self labelDiv.Size = Size(250, 250) labelDiv.Location = Point(30, 20) # Create TextBox for input self.textboxDiv = TextBox() self.textboxDiv.Parent = self self.textboxDiv.Text = "Date 1" self.textboxDiv.Size = Size(150, 150) self.textboxDiv.Location = Point(300, 20) # Create button button = Button() button.Parent = self button.Text = "Ok" button.Location = Point(300, 60) # Register event button.Click += self.ButtonClicked
def __init__(self): """PrintPreviewDialogSample class init function.""" # initialize a PrintDocument object self.doc_to_print = PrintDocument() # setup title self.Text = "PrintPreviewDialog control" # setup button self.button = Button() self.button.Text = "PrintPreviewDialog" self.button.Click += self.click self.button.Width = 150 # setup printpreviewdialog self.printpreviewdialog = PrintPreviewDialog() self.printpreviewdialog.Text = "PrintPreviewDialog" self.printpreviewdialog.ClientSize = Size(500, 300) self.printpreviewdialog.Location = Point(29, 29) self.printpreviewdialog.MinimumSize = Size(375, 250) self.printpreviewdialog.UseAntiAlias = True self.printpreviewdialog.Document = self.doc_to_print self.doc_to_print.PrintPage += self.doc_to_print_PrintPage # add controls self.Controls.Add(self.button)