def __init__(self): self.Text = 'Buttons' self.Size = Size(WIDTH, HEIGHT) ok = Button() PANEL_HEIGHT = ok.Height + PANEL_SPACE panel = Panel() panel.Height = PANEL_HEIGHT panel.Dock = DockStyle.Bottom panel.Parent = self x = ok.Width * 2 + BUTTONS_SPACE y = (PANEL_HEIGHT - ok.Height) / 2 ok.Text = "Ok" ok.Parent = panel ok.Location = Point(WIDTH-x, y) ok.Anchor = AnchorStyles.Right close = Button() x = close.Width close.Text = "Close" close.Parent = panel close.Location = Point(WIDTH-x-CLOSE_SPACE, y) close.Anchor = AnchorStyles.Right self.CenterToScreen()
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, 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): self.Text = 'Directories' self.Size = Size(400, 400) self.tv = TreeView() self.SuspendLayout() self.tv.Parent = self self.tv.Location = Point(10,10) self.tv.Size = Size(self.ClientSize.Width - 20, self.Height - 200) self.tv.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right self.tv.FullRowSelect = False self.tv.ShowLines = True self.tv.ShowPlusMinus = True self.tv.Scrollable = True self.tv.AfterSelect += self.AfterSelect expand = Button() expand.Parent = self expand.Location = Point(20, self.tv.Bottom + 20) expand.Text = 'Expand' expand.Anchor = AnchorStyles.Left | AnchorStyles.Top expand.Click += self.OnExpand expandAll = Button() expandAll.Parent = self expandAll.Location = Point(20, expand.Bottom + 5) expandAll.Text = 'Expand All' expandAll.Anchor = AnchorStyles.Left | AnchorStyles.Top expandAll.Click += self.OnExpandAll collapse = Button() collapse.Parent = self collapse.Location = Point(expandAll.Right + 5, expand.Top) collapse.Text = 'Collapse' collapse.Anchor = AnchorStyles.Left | AnchorStyles.Top collapse.Click += self.OnCollapse collapseAll = Button() collapseAll.Parent = self collapseAll.Location = Point(collapse.Left, collapse.Bottom + 5) collapseAll.Text = 'Collapse All' collapseAll.Anchor = AnchorStyles.Left | AnchorStyles.Top collapseAll.Click += self.OnCollapseAll self.sb = StatusBar() self.sb.Parent = self self.ShowDirectories(self.tv.Nodes, HOME_DIR) self.ResumeLayout() self.CenterToScreen()
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 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, 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): self.Text = 'Anchor' self.Size = Size(210, 210) btn1 = Button() btn1.Text = "Button" btn1.Parent = self btn1.Location = Point(30, 30) btn2 = Button() btn2.Text = "Button" btn2.Parent = self btn2.Location = Point(30, 80) btn2.Anchor = AnchorStyles.Right self.CenterToScreen()
def __init__(self): self.Text = "Button" self.CenterToScreen() self.Size = Size(200, 150) btn = Button() btn.Parent = self btn.Text = "Quit" btn.Location = Point(50, 50) btn.Click += self.OnClick btn.MouseEnter += self.OnEnter
def buttonbox(self): posx = 10 buttonHeight = 40 buttonwidth = 200 w = Button() w.Text = "保存" w.Location = Point(posx, self.Posy) w.Size = Size(buttonwidth, buttonHeight) w.ForeColor = Color.Blue w.Click += self.ok w.Parent = self posx = w.Right + 20 w1 = Button() w1.Text = "退出" w1.Location = Point(posx, self.Posy) w1.Size = Size(buttonwidth, buttonHeight) w1.ForeColor = Color.Blue w1.Click += self.cancel w1.Parent = self self.Posy = w1.Bottom
def buttonbox(self): splitPadsize = 20 buttonHeight = 40 buttonwidth = 200 Width_pad = self.ClientSize.Width - splitPadsize * 2 - buttonwidth * 3 Width_pad /= 2 posx = Width_pad w = Button() w.Text = "刷新余额数据" w.Location = Point(posx, self.Posy) w.Height = buttonHeight w.Width = buttonwidth w.ForeColor = Color.Blue w.Click += self.刷新余额数据 w.Parent = self posx += buttonwidth + splitPadsize w1 = Button() w1.Text = "刷新筛选结果" w1.Location = Point(posx, self.Posy) w1.Height = buttonHeight w1.Width = buttonwidth w1.ForeColor = Color.Blue w1.Click += self.刷新筛选结果 w1.Parent = self posx += buttonwidth + splitPadsize w2 = Button() w2.Text = "退出系统" w2.Location = Point(posx, self.Posy) w2.Height = buttonHeight w2.Width = buttonwidth w2.ForeColor = Color.Blue w2.Click += self.退出系统 w2.Parent = self self.Posy += buttonHeight
def __init__(self): self.Text = "Tooltips" self.CenterToScreen() self.Size = Size(200, 150) tooltip = ToolTip() tooltip.SetToolTip(self, "This is a Form") button = Button() button.Parent = self button.Text = "Button" button.Location = Point(50, 70) tooltip.SetToolTip(button, "This is a Button")
def __init__(self): self.Text = 'Drag & Drop' button = Button() button.Parent = self button.Text = 'Button' button.MouseDown += self.OnMousDown button.MouseUp += self.OnMousUp button.MouseMove += self.OnMousMove button.Location = Point(20, 20) self.isDragging = False self.CenterToScreen()
def __init__(self): self.Text = 'Tooltips' self.CenterToScreen() xsize, ysize = 300, 200 self.Size = Size(xsize, ysize) tooltip = ToolTip() tooltip.SetToolTip(self, "This is a Form") button = Button() button.Parent = self button.Text = "Button" xloc, yloc = 50, 70 button.Location = Point(xloc, yloc) tooltip.SetToolTip(button, "This is a Button")
def __init__(self): self.Text = 'Tooltips' self.CenterToScreen() xsize,ysize=300,200 self.Size = Size(xsize, ysize) tooltip = ToolTip() tooltip.SetToolTip(self, "This is a Form") button = Button() button.Parent = self button.Text = "Button" xloc,yloc=50,70 button.Location = Point(xloc,yloc) tooltip.SetToolTip(button, "This is a Button")
def __init__(self): self.Text = 'Drag & Drop' self.AllowDrop = True button = Button() button.Parent = self textBox = TextBox() textBox.Parent = self button.AllowDrop = True button.Location = Point(150, 50) button.DragDrop += self.OnDragDrop button.DragEnter += self.OnDragEnter textBox.Location = Point(15, 50) textBox.MouseDown += self.OnMousDown self.ClientSize = Size(250, 200) self.CenterToScreen()
def __init__(self): self.Text = "Remove or Move" self.Size = Size(360, 240) self.value = "" # Set style to the selection to the group box displaying the options gb = GroupBox() gb.Text = "Remove files or Move to Another Location" gb.Size = Size(300, 100) gb.Location = Point(20, 20) gb.Parent = self # Remove radius button remove = RadioButton() remove.Text = "Remove" remove.Parent = gb remove.Location = Point(10, 30) remove.CheckedChanged += self.OnChanged # Move radius button backup = RadioButton() backup.Text = "Move to Folder" backup.Parent = gb backup.Size = Size(200, 20) backup.Location = Point(10, 60) backup.CheckedChanged += self.OnChanged # Create button button = Button() button.Parent = self button.Text = "Ok" button.Location = Point(130, 130) # Register event button.Click += self.ButtonClicked # Display the window form to show in the middle of the screen self.CenterToScreen()
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
def __init__(self): self.Text = 'Player' self.Size = Size(350, 280) mainMenu = MainMenu() filem = mainMenu.MenuItems.Add("&File") playm = mainMenu.MenuItems.Add("&Play") view = mainMenu.MenuItems.Add("&View") tools = mainMenu.MenuItems.Add("&Tools") favourites = mainMenu.MenuItems.Add("&Favourites") help = mainMenu.MenuItems.Add("&Help") filem.MenuItems.Add(MenuItem("E&xit", self.OnExit, Shortcut.CtrlX)) self.Menu = mainMenu panel = Panel() panel.Parent = self panel.BackColor = Color.Black panel.Dock = DockStyle.Fill buttonPanel = Panel() buttonPanel.Parent = self buttonPanel.Height = 40 buttonPanel.Dock = DockStyle.Bottom pause = Button() pause.FlatStyle = FlatStyle.Popup pause.Parent = buttonPanel pause.Location = Point(5, 10) pause.Size = Size(25, 25) pause.Image = Bitmap("pause.png") play = Button() play.FlatStyle = FlatStyle.Popup play.Parent = buttonPanel play.Location = Point(35, 10) play.Size = Size(25, 25) play.Image = Bitmap("play.png") forward = Button() forward.FlatStyle = FlatStyle.Popup forward.Parent = buttonPanel forward.Location = Point(80, 10) forward.Size = Size(25, 25) forward.Image = Bitmap("forward.png") backward = Button() backward.FlatStyle = FlatStyle.Popup backward.Parent = buttonPanel backward.Location = Point(110, 10) backward.Size = Size(25, 25) backward.Image = Bitmap("backward.png") tb = TrackBar() tb.Parent = buttonPanel tb.TickStyle = TickStyle.None tb.Size = Size(150, 25) tb.Location = Point(200, 10) tb.Anchor = AnchorStyles.Right audio = Button() audio.FlatStyle = FlatStyle.Popup audio.Parent = buttonPanel audio.Size = Size(25, 25) audio.Image = Bitmap("audio.png") audio.Location = Point(170, 10) audio.Anchor = AnchorStyles.Right sb = StatusBar() sb.Parent = self sb.Text = "Ready" self.CenterToScreen()