def __init__(self): """SplitContainerSample class init function.""" # setup title self.Text = "SplitContainer control" # setup labels self.label1 = Label() self.label1.AutoSize = True self.label1.Text = "label1 in splitcontainer.panel1" self.label2 = Label() self.label2.AutoSize = True self.label2.Text = "label2 in splitcontainer.panel2" # setup splitcontainer self.splitcontainer = SplitContainer() self.splitcontainer.Dock = DockStyle.Fill self.splitcontainer.BorderStyle = BorderStyle.Fixed3D self.splitcontainer.Orientation = Orientation.Horizontal self.splitcontainer.Panel1.BackColor = Color.DarkCyan self.splitcontainer.Panel2.BackColor = Color.Coral # add controls self.splitcontainer.Panel1.Controls.Add(self.label1) self.splitcontainer.Panel2.Controls.Add(self.label2) self.Controls.Add(self.splitcontainer)
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, 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 _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): self.fm = doc.FamilyManager self._all_param_names = None self.Text = 'Параметры' self.Name = 'Select Parameters' self.Width = 400 self.Height = 450 self.title = Label() self.title.Text = "Выберете параметры" self.title.Height = 30 self.title.TextAlign = ContentAlignment.MiddleCenter self.title.Dock = DockStyle.Top self.label = Label() self.label.Text = "Выберете новую группу параметров" self.label.Height = 30 self.label.TextAlign = ContentAlignment.MiddleCenter self.label.Dock = DockStyle.Top self.listbox = ListBox() self.listbox.MultiColumn = False self.listbox.SelectionMode = SelectionMode.MultiExtended self.listbox.BeginUpdate() params = list(self.all_param_names.keys()) params.sort() for i in params: self.listbox.Items.Add(i) self.listbox.EndUpdate() self.listbox.Height = 270 self.listbox.Location = Point(0, 30) self.listbox.Dock = DockStyle.Top self.combobox = ComboBox() els = list(self.all_param_group.keys()) els.sort() for i in els: self.combobox.Items.Add(i) self.combobox.Location = Point(0, 300) self.combobox.Dock = DockStyle.Top self.button = Button() self.button.Text = "Перенести" self.button.Dock = DockStyle.Top self.button.Click += self.change_param_group self.Controls.Add(self.button) self.Controls.Add(self.combobox) self.Controls.Add(self.label) self.Controls.Add(self.listbox) self.Controls.Add(self.title) self.handler = Execute_change_group() self.exEvent = ExternalEvent.Create(self.handler)
def __init__(self): self.Text = "Via Generator" self.Width = 300 self.Height = 200 self.label1 = Label() self.label1.Text = "Number of Layers:" self.label1.Location = Point(50, 25) self.label1.Height = 25 self.label1.Width = 120 self.textbox1 = TextBox() self.textbox1.Text = "8" self.textbox1.Location = Point(200, 25) self.textbox1.Width = 50 self.label2 = Label() self.label2.Text = "Input Layer:" self.label2.Location = Point(50, 50) self.label2.Height = 25 self.label2.Width = 120 self.textbox2 = TextBox() self.textbox2.Text = "1" self.textbox2.Location = Point(200, 50) self.textbox2.Width = 50 self.label3 = Label() self.label3.Text = "Output Layer:" self.label3.Location = Point(50, 75) self.label3.Height = 25 self.label3.Width = 120 self.textbox3 = TextBox() self.textbox3.Text = "8" self.textbox3.Location = Point(200, 75) self.textbox3.Width = 50 self.button1 = Button() self.button1.Text = 'Generate' self.button1.Location = Point(25, 125) self.button1.Click += self.update self.AcceptButton = self.button1 self.Controls.Add(self.label1) self.Controls.Add(self.label2) self.Controls.Add(self.label3) self.Controls.Add(self.textbox1) self.Controls.Add(self.textbox2) self.Controls.Add(self.textbox3) self.Controls.Add(self.button1)
def _populateProductTypeGrpKey(self): self.tlpKeyGrpProductTypeKey.RowCount = len(self.productNames) i = -1 for name in self.productNames: i+=1 #must put str values into control because of TableLayoutPanel lblProduct = Label() lblProduct.Text = name lblNumber = Label() lblNumber.Text = str(i) self.tlpKeyGrpProductTypeKey.Controls.Add(lblProduct) self.tlpKeyGrpProductTypeKey.Controls.Add(lblNumber)
def header(self, x, y): style = FontStyle.Bold levels_selected = '-' objects_selected = '-' self.sublabel = Label() self.sublabel.Text = "Number of Levels Selected: " + str( levels_selected) self.sublabel.Location = Point(x + 40, y + 10) self.sublabel.Width = width - 200 self.sublabel.Font = Font("Calibri Light", 12) #self.sublabel.ForeColor = Color.White #self.sublabel.ForeColor = Color.FromArgb(242, 112, 108) #self.sublabel.ForeColor = Color.Black self.sublabel_objects = Label() self.sublabel_objects.Text = "Number of Objects Current Selection: " + str( objects_selected) self.sublabel_objects.Location = Point(x + 40, y + 30) self.sublabel_objects.Width = width - 200 self.sublabel_objects.Font = Font("Calibri Light", 12) #self.sublabel_objects.ForeColor = Color.White self.sublabel_objects.ForeColor = Color.FromArgb(242, 112, 108) self.sublabel_objects.ForeColor = Color.Black self.sublabel_no_selection = Label() self.sublabel_no_selection.Text = "" self.sublabel_no_selection.Location = Point(x + 40, y + 50) self.sublabel_no_selection.Width = width - 200 self.sublabel_no_selection.Font = Font("Calibri Light", 12) #self.sublabel_no_selection.ForeColor = Color.White self.sublabel_no_selection.ForeColor = Color.FromArgb(242, 112, 108) self.sublabel_no_selection.ForeColor = Color.Black self.header = Panel() self.header.Width = width self.header.Height = 80 self.header.AutoSize = True self.header.Font = Font("Calibri", 12) self.header.Location = Point(x, y) self.header.BackColor = Color.FromArgb(145, 201, 213) self.header.Controls.Add(self.sublabel) self.header.Controls.Add(self.sublabel_objects) self.header.Controls.Add(self.sublabel_no_selection) self.header.AutoScroll = True return self.header
def header(self, x, y): style = FontStyle.Bold assembly_codes_selected = '-' objects_selected = '-' self.sublabel = Label() self.sublabel.Text = "ProjectBasePoint (E/W, N/S, Elev)" self.sublabel.Location = Point(x+40, y+10) self.sublabel.Width = width-200 self.sublabel.Font = Font("Calibri Light", 12) self.sublabel.Width = 400 #self.sublabel.ForeColor = Color.White self.sublabel.ForeColor = Color.Black self.sublabel_objects = Label() self.sublabel_objects.Text = "SharedBasePoint (E/W, N/S, Elev)" self.sublabel_objects.Location = Point(x+40, y+30) self.sublabel_objects.Width = width-200 self.sublabel_objects.Font = Font("Calibri Light", 12) self.sublabel_objects.Width = 400 #self.sublabel_objects.ForeColor = Color.White self.sublabel.ForeColor = Color.Black self.sublabel_no_selection = Label() self.sublabel_no_selection.Text = "" self.sublabel_no_selection.Location = Point(x+40, y+50) self.sublabel_no_selection.Width = width-200 self.sublabel_no_selection.Font = Font("Calibri Light", 12, style) #self.sublabel_no_selection.ForeColor = Color.White self.sublabel.ForeColor = Color.Black self.header = Panel() self.header.Width = width self.header.Height = 80 self.header.AutoSize = True self.header.Font = Font("Calibri", 12) self.header.Location = Point(x,y) #self.header.BackColor = Color.FromArgb(0, 0, 0) self.header.BackColor = Color.FromArgb(145, 201, 213) self.header.Controls.Add(self.sublabel) self.header.Controls.Add(self.sublabel_objects) self.header.Controls.Add(self.sublabel_no_selection) self.header.AutoScroll = True return self.header
def __init__(self, strName, strID): print("Create ListRow") self.initLabel() self.lblName = Label() self.lblID = Label() self.tbNumber = TextBox() self.initTextBoxNumber() self.initLabelName(strName) self.initLabelID(strID) self.Controls.Add(self.lblName) self.Controls.Add(self.lblID) self.Controls.Add(self.tbNumber)
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 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, 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): """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): """ComboBoxSample class init function.""" # setup title self.Text = "ComboBox control" self.Height = 400 # setup label self.label = Label() self.label.Text = "You select " self.label.AutoSize = True self.label.Dock = DockStyle.Top # setup combobox self.combobox = ComboBox() self.combobox.Dock = DockStyle.Top self.combobox.SelectionChangeCommitted += self.select self.combobox.DropDownStyle = ComboBoxStyle.Simple self.combobox.SelectedIndexChanged += self.select self.combobox.Height = 300 # add items in ComboBox for i in range(10): self.combobox.Items.Add(str(i)) # add controls self.Controls.Add(self.combobox) self.Controls.Add(self.label)
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, RB_print): self.RB_print = RB_print self.Text = 'RedBim' self.Name = 'RedBimPrinter' self.Height = 500 self.Width = 700 self.AutoScroll = True self.AutoScaleMode = AutoScaleMode.Font self.BackColor = Color.FromArgb(67, 67, 67) # self.BackgroundImage = Image.FromFile(os.path.join(STATIC_IMAGE, "bg.png")) # self.BackgroundImageLayout = ImageLayout.Center self.Icon = Icon(os.path.join(STATIC_IMAGE, "icon.ico"), 16, 16) self.StartPosition = FormStartPosition.CenterScreen self.label = Label() self.label.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right) self.label.BackColor = Color.FromArgb(0, 0, 0, 0) self.label.Font = Font("ISOCPEUR", 12, FontStyle.Italic) self.label.ForeColor = Color.White self.label.Location = Point(0, 0) self.label.Name = "text" self.label.Dock = DockStyle.Top self.label.AutoSize = True self.Controls.Add(self.label) self.label.Click += self.add_to_clipboard
def _initializeUserInterface(self): self.Size = Size(1600, 500) self.tlpMain.ColumnCount = len(self.columnNames) self.tlpMain.RowCount = 2 self.tlpMain.Size = self.ClientRectangle.Size #create list titles for name in self.columnNames: lbl = Label() lbl.Text = name lbl.Font = Font("Microsoft Sans Serif", 12, FontStyle.Bold) lbl.Height = 50 self.tlpMain.Controls.Add(lbl) #create lists for name in self.columnNames: lst = ListBox() lst.Name = name lst.Font = Font("Microsoft Sans Serif", 10) lst.Width = 135 if name.ToLower() == 'attribute': lst.Width = 300 if name.ToLower() == 'mode': lst.Width = 215 lst.Height = self.ClientRectangle.Height - (lbl.Height * 2) self.tlpMain.Controls.Add(lst) self._populateLists(lst)
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 __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): #the __init__ method inside a class is its constructor self.Text = "AU London" #text that appears in the GUI titlebar self.Icon = Icon.FromHandle(icon.GetHicon()) #takes a bitmap image and converts to a file that can be used as a Icon for the titlebar self.BackColor = Color.FromArgb(255, 255, 255) self.WindowState = FormWindowState.Normal # set maximised minimised or normal size GUI self.CenterToScreen() # centres GUI to the middle of your screen self.BringToFront() #brings the GUI to the front of all opens windows. self.Topmost = True # true to display the GUI infront of any other active forms screenSize = Screen.GetWorkingArea(self) #get the size of the computers main screen, as the form will scale differently to different sized screens self.Width = screenSize.Width / 4 #set the size of the form based on the size of the users screen. this helps to ensure consistant look across different res screens. self.Height = screenSize.Height / 4 uiWidth = self.DisplayRectangle.Width #get the size of the form to use to scale form elements uiHeight = self.DisplayRectangle.Height #self.FormBorderStyle = FormBorderStyle.FixedDialog # fixed dialog stops the user from adjusting the form size. Recomended disabling this when testing to see if elements are in the wrong place. self.userOutput = userOutputDefaultStr #create a container to store the output from the form self.runNextOutput = False #set these default values #############-------------\-------------############# spacing = 10 #spacing size for GUI elements to form a consistent border # creates the text box for a info message userMessage = Label() #label displays texts font = Font("Helvetica ", 10) userMessage.Text = message userMessage.Font = font userMessage.Location = Point(spacing, spacing) #all location require a point object from system.Drawing to set the location. userMessage.Size = Size(uiWidth-(spacing*2),(uiHeight/4)) #size the control with the width of the GUI to ensure it scales with different screen self.Controls.Add(userMessage) #this adds control element to the GUI
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 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 __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, 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 __init__(self): #the __init__ method inside a class is its constructor self.Text = "AU London" #text that appears in the GUI titlebar self.Icon = Icon.FromHandle(icon.GetHicon()) self.BackColor = Color.FromArgb(255, 255, 255) self.WindowState = FormWindowState.Normal self.CenterToScreen() self.BringToFront() self.TopMost = True screenSize = Screen.GetWorkingArea(self) self.Width = screenSize / 4 self.Height = screenSize / 4 uiWidth = self.DisplayRectangle.Width uiHeight = self.DisplayRectangle.Height spacing = 10 userMessage = Label() font = Font("Helvetica", 10) userMessage.Text = message userMessage.Font = font userMessage.Location = Point(spacing, spacing) userMessage.Size = Size(uiWidth - (spacing * 2), (uiHeight / 4)) self.Controls.Add(userMessage)
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 __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): 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()