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): 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 __build_advancedtab(self): ''' builds and returns the "Advanced" Tab for the TabControl ''' tabpage = TabPage() tabpage.Text = i18n.get("ConfigFormAdvancedTab") # 1. --- a description label for this tabpage label = Label() label.UseMnemonic = False label.AutoSize = True label.Location = Point(14, 25) label.Size = Size(299, 17) label.Text = i18n.get("ConfigFormAdvancedText") # 2. --- build the update checklist (contains all the 'data' checkboxes) tbox = RichTextBox() tbox.Multiline = True tbox.MaxLength = 65536 tbox.WordWrap = True tbox.Location = Point(15, 50) tbox.Size = Size(355, 200) menu = ContextMenu() items = menu.MenuItems items.Add(MenuItem(i18n.get("TextCut"), lambda s, ea: tbox.Cut())) items.Add(MenuItem(i18n.get("TextCopy"), lambda s, ea: tbox.Copy())) items.Add(MenuItem(i18n.get("TextPaste"), lambda s, ea: tbox.Paste())) tbox.ContextMenu = menu self.__advanced_tbox = tbox # 3. --- add 'em all to the tabpage tabpage.Controls.Add(label) tabpage.Controls.Add(self.__advanced_tbox) return tabpage
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 __init__(self, posx, posy, hight, width, title, curvlaue, name): super(金额Entry, self).__init__(self) self.格式说明 = "数值,或者类似 5吨*3元每吨*付款比例30%-扣减金额1000" # self.Font= Font("楷体_GB2312", 24); self.Notify = None self.curvalue = self.格式说明 self.ctrlwidth = width / 2 self.Location = Point(posx, posy) self.Size = Size(width, hight) self.title = title self.name = name # fontsize = self.ClientSize.Height*7/10 # print(self.ClientSize.Height ,self.Size.Height ) self.Font = self.getFont() self.label = Label() self.label.Location = Point(0, 0) self.label.Size = Size(self.ctrlwidth, hight) self.label.Parent = self self.label.Text = title self.label.Font = self.Font self.label.TextAlign = ContentAlignment.MiddleRight self.cb = TextBox() self.cb.Parent = self self.cb.Location = Point(self.ctrlwidth, 0) self.cb.Size = Size(self.ctrlwidth, hight) self.cb.Text = self.curvalue self.cb.Font = self.Font self.cb.ForeColor = Color.Blue self.cb.TextChanged += self.OnChanged
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 panel(self, x, y): self.panel = Panel() self.panel.Width = width - 15 self.panel.Height = 800 self.panel.Location = Point(x, y) self.panel.BorderStyle = BorderStyle.Fixed3D self.panel.BackColor = Color.White self.panel.AutoScroll = True j = 30 for i in sorted_list: self.checkbox = CheckBox() self.checkbox.Text = i[0] self.checkbox.Location = Point(35, j) self.checkbox.Font = Font("Calibri Light", 10) self.checkbox_description = Label() self.checkbox_description.Text = i[1] self.checkbox_description.Location = Point(150, j + 2) self.checkbox_description.Width = 500 self.checkbox_description.Font = Font("Calibri Light", 10) self.panel.Controls.Add(self.checkbox) self.panel.Controls.Add(self.checkbox_description) self.check_value.append(self.checkbox) j += 25 return self.panel
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): self.Text = "UK Trains Win" self.AutoScaleBaseSize = Size(5, 13) self.ClientSize = Size(1600, 117) h = WinForms.SystemInformation.CaptionHeight self.MinimumSize = Size(500, (600 + h)) # Create the button self.button = WinForms.Button() self.button.Location = Point(32, 540) self.button.Size = Size(100, 20) self.button.TabIndex = 2 self.button.Text = "Refresh" # Register the event handler self.button.Click += self.button_Click self.departCount = WinForms.Label() self.departCount.Text = "departure count" self.departCount.Size = Size(400, 40) self.departCount.Location = Point(8, 12) # Create the text box self.textbox = WinForms.Label() self.textbox.Text = "train details should be here" self.textbox.TabIndex = 1 self.textbox.Size = Size(1600, 400) self.textbox.Location = Point(16, 32) # Add the controls to the form self.AcceptButton = self.button self.Controls.Add(self.button) self.Controls.Add(self.textbox) self.Controls.Add(self.departCount)
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 __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 _initialize_components(self): self._generate_menu_strip() self._create_buttons() flags_description = Label() flags_description.Parent = self flags_description.Text = 'Flags:' flags_description.Location = Point(10, 30) flags_description.Size = TextRenderer.MeasureText( flags_description.Text, flags_description.DefaultFont) self._result = Label() self._result.Parent = self self._result.Text = '' self._result.Size = TextRenderer.MeasureText(self._result.Text, self._result.DefaultFont) self._result.Location = Point( self.Size.Width / 2 - self._result.Size.Width / 2 - 5, 30) self._flags_counter = Label() self._flags_counter.Parent = self self._flags_counter.Location = Point(45, 30) self._flags_counter.Size = Size(30, 20) self._label_timer = Label() self._label_timer.Parent = self self._label_timer.TextAlign = ContentAlignment.MiddleRight self._label_timer.Location = Point(self.Size.Width - 70, 30) self._label_timer.Size = Size(40, 20)
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, 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 panel(self, x, y): self.panel = Panel() self.panel.Width = width - 15 self.panel.Height = 800 self.panel.Location = Point(x, y) self.panel.BorderStyle = BorderStyle.Fixed3D self.panel.BackColor = Color.White self.panel.AutoScroll = True j = 35 for i in total_point_list: for x in i: self.label = Label() if (len(x)) > 1: if x[1] is not None: self.label.Text = str(x[0]) + " " + str(x[1]) self.label.Location = Point(35, j) self.label.Width = 400 self.label.Font = Font("Calibri Light", 12) self.panel.Controls.Add(self.label) j += 25 return self.panel
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 setupCheckButtons(self): self.checkPanel = self.newPanel(0,0) self.checkLabel = Label() self.checkLabel.Text = "Choose the ROI(s) that represents GTV68" self.checkLabel.Location = Point(25, 25) self.checkLabel.AutoSize = True self.checkBoxList = [CheckBox() for i in range(0, len(self.roi_names))] checkBoxJumper = [i*4 for i in range(1, int(ceil(len(self.roi_names)/4.)))] xcounter = 0 ycounter = 1 for i in range(0, len(self.roi_names)): for j in checkBoxJumper: if i == j: xcounter = 0 ycounter += 1 self.checkBoxList[i].Text = self.roi_names[i] self.checkBoxList[i].Location = Point(xcounter*160 + 25, 55*ycounter) xcounter += 1 self.checkBoxList[i].Width = 150 self.checkPanel.Controls.Add(self.checkBoxList[i]) self.checkPanel.Controls.Add(self.checkLabel)
def __init__(self): self.StartPosition = FormStartPosition.CenterScreen self.FormBorderStyle = FormBorderStyle.FixedDialog self.Text = 'Текст' self.Name = 'Имя' self.Size = Size(500, 250) self.MaximizeBox = False self.MinimizeBox = False self.msg = [] gb = GroupBox() gb.Text = "Категории" gb.Size = Size(120, 110) gb.Location = Point(20, 20) gb.Parent = self j = 25 for c in cats: self.cb = CheckBox() self.cb.Text = c self.cb.Location = Point(25, j) j += 25 self.cb.Width = 200 self.cb.Checked += self.OnChanged gb.Size = Size(120, 20 + j) gb.Controls.Add(self.cb) self.label = Label() self.label.Text = "Результат" self.label.Location = Point(225, 20) self.label.Height = 25 self.label.Width = 225 self.Controls.Add(self.label) self.label.Text = "".join(self.msg)
def __init__(self, posx, posy, hight, width, title, curvlaue, values, name): # print( width ,"^^^^^^^^^^^^^^^") self._Padding = 3 super(ComboCtrlview, self).__init__(self) self._Values = values self.Notify = None self.curvalue = "" self.ctrlwidth = (width - self._Padding) / 2 self.Size = Size(width, hight) self.Location = Point(posx, posy) self.name = name self.Font = self.getFont() self.label = Label() self.label.Parent = self self.label.Text = title self.label.Font = self.Font self.label.Location = Point(0, 0) self.label.Size = Size(self.ctrlwidth, hight) self.label.TextAlign = ContentAlignment.MiddleRight self.cb = ComboBox() self.cb.Parent = self self.cb.Items.AddRange(self._Values) if len(curvlaue) > 0: self.cb.Text = curvlaue self.cb.Font = self.Font self.cb.ForeColor = Color.Blue self.cb.SelectedValueChanged += self.OnChanged self.cb.DropDown += self.TextUpdate self.cb.Location = Point(self.label.Right + self._Padding, 0) self.cb.Size = Size(self.ctrlwidth, hight)
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, 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 initHeaderForListPanel(self): self.headerListPanel = Panel() self.headerListPanel.BackColor = Color.White self.headerListPanel.Width = 360 self.headerListPanel.Height = 30 self.headerListPanel.Location = Point(0, 0) self.lblName = Label() self.lblName.Width = 100.67 self.lblName.Height = 30 self.lblName.Location = Point(0, 0) self.lblName.TextAlign = ContentAlignment.MiddleCenter self.lblName.Text = "Name" self.lblID = Label() self.lblID.Width = 100.67 self.lblID.Height = 30 self.lblID.Location = Point(109, 0) self.lblID.TextAlign = ContentAlignment.MiddleCenter self.lblID.Text = "ID" self.lblNumber = Label() self.lblNumber.Width = 100.67 self.lblNumber.Height = 30 self.lblNumber.Location = Point(218, 0) self.lblNumber.TextAlign = ContentAlignment.MiddleCenter self.lblNumber.Text = "Number" self.headerListPanel.Controls.Add(self.lblName) self.headerListPanel.Controls.Add(self.lblID) self.headerListPanel.Controls.Add(self.lblNumber)
def init(self): """Initialize the form. Returns ------- None """ textbox = TextBox() textbox.Text = str(self.value) textbox.Location = Point(10, 10) textbox.Width = 40 textbox.TextChanged += System.EventHandler(self.on_textchanged) trackbar = TrackBar() trackbar.Minimum = self.minval trackbar.Maximum = self.maxval trackbar.SmallChange = self.step trackbar.LargeChange = self.step trackbar.TickFrequency = self.step trackbar.Value = self.value trackbar.Width = 460 trackbar.Location = Point(60, 10) trackbar.Scroll += System.EventHandler(self.on_scroll) self.Controls.Add(textbox) self.Controls.Add(trackbar) self.ClientSize = Size(10 + textbox.Width + 10 + trackbar.Width + 10, trackbar.Height + 10) self.textbox = textbox self.trackbar = trackbar
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, posx, posy, hight, width, title, curvlaue, name): super(generalEntry, self).__init__(self) self.格式说明 = "不能为空" self.Notify = None self.curvalue = self.格式说明 # self.Width = width self.ctrlwidth = width / 2 # self.Height =hight self.Size = Size(width, hight) self.Location = Point(posx, posy) self.title = title self.name = name self.Font = self.getFont() self.label = Label() self.label.Location = Point(0, 0) self.label.Size = Size(self.ctrlwidth, hight) self.label.Parent = self self.label.Text = title self.label.Font = self.Font self.label.TextAlign = ContentAlignment.MiddleRight self.cb = TextBox() self.cb.Parent = self self.cb.Location = Point(self.ctrlwidth, 0) self.cb.Size = Size(self.ctrlwidth, hight) self.cb.Text = self.curvalue self.cb.Font = self.Font self.cb.ForeColor = Color.Blue self.cb.TextChanged += self.OnChanged
def __build_label(self, series_ref): ''' builds and returns the main text label for this form ''' # 1. compute the best possible full name for the given SeriesRef name_s = series_ref.series_name_s publisher_s = series_ref.publisher_s vol_year_n = series_ref.volume_year_n vol_year_s = sstr(vol_year_n) if vol_year_n > 0 else '' fullname_s = '' if name_s: if publisher_s: if vol_year_s: fullname_s = "'"+name_s+"' ("+publisher_s+", " + vol_year_s + ")" else: fullname_s = "'"+name_s+"' (" + publisher_s + ")" else: fullname_s = "'"+name_s+"'" label = Label() label.UseMnemonic = False sep = ' ' if len(fullname_s) > 40 else '\n' label.Text = i18n.get("IssueFormChooseText").format(fullname_s, sep) if self.__config.show_covers_b: label.Location = Point(218, 20) label.Size = Size(480, 40) else: label.Location = Point(10, 20) label.Size = Size(680, 40) return label
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, 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 __init__(self): self.Text = "Hello World From Python" self.AutoScaleBaseSize = Size(5, 13) self.ClientSize = Size(392, 117); h = WinForms.SystemInformation.CaptionHeight self.MinimumSize = Size(392, (117 + h)) # Create the button self.button = WinForms.Button() self.button.Location = Point(160, 64) self.button.Size = Size(820, 20) self.button.TabIndex = 2 self.button.Text = "Click Me!" # Register the event handler self.button.Click += self.button_Click # Create the text box self.textbox = WinForms.TextBox() self.textbox.Text = "Hello World" self.textbox.TabIndex = 1 self.textbox.Size = Size(1260, 40) self.textbox.Location = Point(160, 24) # Add the controls to the form self.AcceptButton = self.button self.Controls.Add(self.button); self.Controls.Add(self.textbox);
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): """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 test_struct_construction(): """Test construction of structs.""" from System.Drawing import Point p = Point() assert p.X == 0 assert p.Y == 0 p = Point(0, 0) assert p.X == 0 assert p.Y == 0 p.X = 10 p.Y = 10 assert p.X == 10 assert p.Y == 10
def testStructConstruction(self): """Test construction of structs.""" from System.Drawing import Point p = Point() self.assertTrue(p.X == 0) self.assertTrue(p.Y == 0) p = Point(0, 0) self.assertTrue(p.X == 0) self.assertTrue(p.Y == 0) p.X = 10 p.Y = 10 self.assertTrue(p.X == 10) self.assertTrue(p.Y == 10)
def testStructConstruction(self): """Test construction of structs.""" from System.Drawing import Point def test(): p = Point() self.failUnlessRaises(TypeError, test) p = Point(0, 0) self.failUnless(p.X == 0) self.failUnless(p.Y == 0) p.X = 10 p.Y = 10 self.failUnless(p.X == 10) self.failUnless(p.Y == 10)
def testBoxedValueTypeMutationResult(self): """Test behavior of boxed value types.""" # This test actually exists mostly as documentation of an important # concern when dealing with value types. Python does not have any # value type semantics that can be mapped to the CLR, so it is easy # to accidentally write code like the following which is not really # mutating value types in-place but changing boxed copies. from System.Drawing import Point from System import Array items = Array.CreateInstance(Point, 5) for i in range(5): items[i] = Point(i, i) for i in range(5): # Boxed items, so settr will not change the array member. self.failUnless(items[i].X == i) self.failUnless(items[i].Y == i) items[i].X = i + 1 items[i].Y = i + 1 self.failUnless(items[i].X == i) self.failUnless(items[i].Y == i) for i in range(5): # Demonstrates the workaround that will change the members. self.failUnless(items[i].X == i) self.failUnless(items[i].Y == i) item = items[i] item.X = i + 1 item.Y = i + 1 items[i] = item self.failUnless(items[i].X == i + 1) self.failUnless(items[i].Y == i + 1)