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 _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 addNameLabel(self, name, imageName, location): label = Label() label.Parent = self label.AutoSize = True label.Location = location label.Text = name label.MouseEnter += lambda *_: self.switchImage(imageName) label.MouseLeave += self.resetImage
def add_heading_label(text, panel): # add heading label label = Label() label.Parent = panel label.Text = text label.AutoSize = True label.Font = HEADER_FONT label.Margin = Padding(0, 5, 0, 5)
def ShowDialog(self, controller, title, text, default_input, exp_index): # set controller self.controller = controller # set exp index self.exp_index = exp_index # initialize exp name variable self.exp_name = None # initialize invalid name label self.invalid_name_label = None # create the form self.dialog_window = Form() self.dialog_window.AutoSize = True self.dialog_window.Width = 400 self.dialog_window.MaximumSize = Size(400, 160) self.dialog_window.StartPosition = FormStartPosition.CenterScreen self.dialog_window.Text = title self.dialog_window.FormBorderStyle = FormBorderStyle.FixedSingle # create the main panel self.panel = FlowLayoutPanel() self.panel.Parent = self.dialog_window self.panel.BackColor = DIALOG_COLOR self.panel.Dock = DockStyle.Top self.panel.Padding = Padding(10, 10, 0, 10) self.panel.FlowDirection = FlowDirection.TopDown self.panel.WrapContents = False self.panel.AutoSize = True self.panel.Font = BODY_FONT # add the dialog text exp_name_label = Label() exp_name_label.Parent = self.panel exp_name_label.Text = text exp_name_label.Width = self.panel.Width exp_name_label.AutoSize = True exp_name_label.Margin = Padding(0, 5, 0, 0) # add the textbox self.exp_name_box = TextBox() self.exp_name_box.Text = default_input self.exp_name_box.Parent = self.panel self.exp_name_box.Width = self.panel.Width - 30 self.exp_name_box.AutoSize = True self.exp_name_box.BackColor = BUTTON_PANEL_COLOR self.exp_name_box.Font = Font(BODY_FONT.FontFamily, 9) # add save button panel self.add_save_button_panel() # show the dialog self.dialog_window.ShowDialog() # return the exp name return self.exp_name
def add_param_label(text, panel): # add param label label = Label() label.Parent = panel label.Text = text label.AutoSize = True label.Font = BODY_FONT label.Margin = Padding(0, 5, 0, 0) label.Width = panel.Width
def popup(text): form = Form() form.StartPosition = FormStartPosition.CenterScreen form.Width = 300 form.Height = 300 form.Text = 'Mais pas tout le temps' label = Label() label.Text = text label.Width = 300 label.Height = 300 label.Parent = form form.ShowDialog()
def __init__(self): self.Text = "You know I'm No Good" font = Font("Serif", 10) lyrics = Label() lyrics.Parent = self lyrics.Text = text lyrics.Font = font lyrics.Location = Point(10, 10) lyrics.Size = Size(390, 390) self.Size = Size(400,400) self.CenterToScreen()
def __init__(self, imagePath): Form.__init__(self) self.Width = 346 self.Height = 215 self.images = dict((name, loadImage(imagePath, name + '.jpg')) for name in ('pycon', 'andrzej', 'michael', 'christian')) self.pictureBox = PictureBox() self.pictureBox.Parent = self self.pictureBox.Location = Point(234, 12) self.pictureBox.TabStop = False self.switchImage("pycon") self.mainText = Label() self.mainText.Parent = self self.mainText.AutoSize = True self.mainText.Location = Point(12, 12); self.mainText.Text = ("Tabbed Image Viewer\r\n\r\nWritten for PyCon 2007\r\n" "Using IronPython and Windows Forms\r\n\r\nBy:") self.addNameLabel("Andrzej Krzywda", "andrzej", Point(36, 90)) self.addNameLabel("Christian Muirhead", "christian", Point(36, 105)) self.addNameLabel("Michael Foord", "michael", Point(36, 120)) versionLabel = Label() versionLabel.Parent = self versionLabel.AutoSize = True versionLabel.Location = Point(12, 151) versionLabel.Text = "Version: " + __revision__ self.okButton = Button() self.okButton.Parent = self self.okButton.Text = "OK" self.okButton.Location = Point(251, 146) self.okButton.Click += self.onOK self.AcceptButton = self.okButton self.Text = "About" self.FormBorderStyle = FormBorderStyle.FixedDialog self.MinimizeBox = False self.MaximizeBox = False
def ShowDialog(self, controller, title, text): # set controller self.controller = controller # create confirmation boolean -- True means the user wants to save # the stimulus settings and stop the currently running stimulation. self.confirmation = False # create the form self.dialog_window = Form() self.dialog_window.AutoSize = True self.dialog_window.Width = 400 self.dialog_window.MaximumSize = Size(400, 225) self.dialog_window.StartPosition = FormStartPosition.CenterScreen self.dialog_window.Text = title self.dialog_window.FormBorderStyle = FormBorderStyle.FixedSingle # create the main panel self.panel = FlowLayoutPanel() self.panel.Parent = self.dialog_window self.panel.BackColor = DIALOG_COLOR self.panel.Dock = DockStyle.Top self.panel.Padding = Padding(10, 10, 0, 10) self.panel.FlowDirection = FlowDirection.TopDown self.panel.WrapContents = False self.panel.AutoSize = True self.panel.Font = BODY_FONT # add the dialog text dialog_label = Label() dialog_label.Parent = self.panel dialog_label.Text = text dialog_label.Width = self.panel.Width dialog_label.AutoSize = True dialog_label.Margin = Padding(0, 5, 0, 0) # add button panel self.add_button_panel() # show the dialog self.dialog_window.ShowDialog() # return the exp name return self.confirmation
def populate_stim_choice_panel(self): # empty stim choice panel list_of_controls = self.stim_choice_panel.Controls for control in list_of_controls: control.Dispose() self.stim_choice_panel.Controls.Clear() # add stim choice label stim_choice_label = Label() stim_choice_label.Parent = self.stim_choice_panel stim_choice_label.Text = "Stim:" stim_choice_label.AutoSize = True # add stim chooser self.stim_chooser = ComboBox() self.stim_chooser.DropDownStyle = ComboBoxStyle.DropDownList self.stim_chooser.Parent = self.stim_choice_panel self.stim_chooser.Items.AddRange(("Looming Dot", "Moving Dot", "Combined Dots", "Optomotor Grating", "Grating", "Broadband Grating", "Delay", "Black Flash", "White Flash")) ##!! need to add option for OKR here self.stim_chooser.SelectionChangeCommitted += self.on_stim_choice self.stim_chooser.Text = self.stim_type self.stim_chooser.Width = self.dialog_window.Width - 40 self.stim_chooser.AutoSize = True self.stim_chooser.Font = BODY_FONT
def __init__(self, title): # Create the form self.Name = "Create Window" self.Text = title self.Size = Size(370, 590) self.CenterToScreen() self.value = "" self.value1 = "" self.value2 = "" self.value3 = "" self.value4 = "" self.value5 = "" self.value6 = "" self.value7 = "" self.value8 = "" self.finalValue = [] # Create label for input title labelDiv = Label(Text="Door Type") labelDiv.Parent = self labelDiv.Size = Size(150, 20) labelDiv.Location = Point(30, 40) # Create TextBox for input self.textboxDiv = TextBox() self.textboxDiv.Parent = self self.textboxDiv.Text = "" self.textboxDiv.Location = Point(200, 40) # Create label for input title labelDiv1 = Label(Text="Door Frame Type") labelDiv1.Parent = self labelDiv1.Size = Size(150, 20) labelDiv1.Location = Point(30, 80) # Create TextBox for input self.textboxDiv1 = TextBox() self.textboxDiv1.Parent = self self.textboxDiv1.Text = "" self.textboxDiv1.Location = Point(200, 80) # Create label for input title labelDiv2 = Label(Text="Door Frame Finish") labelDiv2.Parent = self labelDiv2.Size = Size(150, 20) labelDiv2.Location = Point(30, 120) # Create TextBox for input self.textboxDiv2 = TextBox() self.textboxDiv2.Parent = self self.textboxDiv2.Text = "" self.textboxDiv2.Location = Point(200, 120) # Create label for input title labelDiv3 = Label(Text="Door Leaf Type") labelDiv3.Parent = self labelDiv3.Size = Size(150, 20) labelDiv3.Location = Point(30, 160) # Create TextBox for input self.textboxDiv3 = TextBox() self.textboxDiv3.Parent = self self.textboxDiv3.Text = "" self.textboxDiv3.Location = Point(200, 160) # Create label for input title labelDiv4 = Label(Text="Meeting Styles") labelDiv4.Parent = self labelDiv4.Size = Size(150, 20) labelDiv4.Location = Point(30, 200) # Create TextBox for input self.textboxDiv4 = TextBox() self.textboxDiv4.Parent = self self.textboxDiv4.Text = "" self.textboxDiv4.Location = Point(200, 200) # Create label for input title labelDiv5 = Label(Text="Door Leaf Material") labelDiv5.Parent = self labelDiv5.Size = Size(150, 20) labelDiv5.Location = Point(30, 240) # Create TextBox for input self.textboxDiv5 = TextBox() self.textboxDiv5.Parent = self self.textboxDiv5.Text = "" self.textboxDiv5.Location = Point(200, 240) # Create label for input title labelDiv6 = Label(Text="Door Leaf Finish") labelDiv6.Parent = self labelDiv6.Size = Size(150, 20) labelDiv6.Location = Point(30, 280) # Create TextBox for input self.textboxDiv6 = TextBox() self.textboxDiv6.Parent = self self.textboxDiv6.Text = "" self.textboxDiv6.Location = Point(200, 280) # Create label for input title labelDiv7 = Label(Text="Fire/Smoke") labelDiv7.Parent = self labelDiv7.Size = Size(150, 20) labelDiv7.Location = Point(30, 320) # Create TextBox for input self.textboxDiv7 = TextBox() self.textboxDiv7.Parent = self self.textboxDiv7.Text = "" self.textboxDiv7.Location = Point(200, 320) # Create label for input title labelDiv8 = Label(Text="Door Security") labelDiv8.Parent = self labelDiv8.Size = Size(150, 20) labelDiv8.Location = Point(30, 360) # Create TextBox for input self.textboxDiv8 = TextBox() self.textboxDiv8.Parent = self self.textboxDiv8.Text = "" self.textboxDiv8.Location = Point(200, 360) # Create label for input title labelDiv9 = Label(Text="Misc") labelDiv9.Parent = self labelDiv9.Size = Size(150, 20) labelDiv9.Location = Point(30, 400) # Create TextBox for input self.textboxDiv9 = TextBox() self.textboxDiv9.Parent = self self.textboxDiv9.Text = "" self.textboxDiv9.Location = Point(200, 400) # Create label for input title labelDiv10 = Label(Text="Comments") labelDiv10.Parent = self labelDiv10.Size = Size(150, 20) labelDiv10.Location = Point(30, 440) # Create TextBox for input self.textboxDiv10 = TextBox() self.textboxDiv10.Parent = self self.textboxDiv10.Text = "" self.textboxDiv10.Location = Point(200, 440) # Create button button = Button() button.Parent = self button.Text = "Ok" button.Location = Point(200, 490) button.Size = Size(100, 20) # Register event button.Click += self.ButtonClicked