コード例 #1
0
 def miniPanel(self, x, y):
     panel = Panel()
     panel.Width = 750
     panel.Height = 150
     panel.Location = Point(x, y)
     panel.BorderStyle = BorderStyle.None
     return panel                           
コード例 #2
0
 def medPanel(self, x, y):
     panel = Panel()
     panel.Width = 300
     panel.Height = 300
     panel.Location = Point(x, y)
     panel.BorderStyle = BorderStyle.FixedSingle
     return panel
コード例 #3
0
    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()    
コード例 #4
0
ファイル: configForm.py プロジェクト: kiranba/the-fascinator
 def __init__(self, watcher=None):
     #
     self.__watcher = watcher
     self.Text = "FileWatcher configuration"
     self.__table = TableLayoutPanel()
     self.MinimumSize = Size(520, 360)
     self.Size = Size(640, 360)
     self.MaximizeBox = False
     self.Icon = Icon("watcher.ico")
     p = Panel()
     p.Padding = Padding(10, 0, 10, 10)
     exitBut = Button(Text="E&xit")
     p.Height = exitBut.Height + 10
     p.Controls.Add(exitBut)
     exitBut.Dock = DockStyle.Right
     p.Dock = DockStyle.Bottom
     def exit(s, e):
         self.Dispose()
     exitBut.Click += exit
     self.Controls.Add(p)
     self.Controls.Add(self.__table)
     label = Label(Text="Watch Directories")
     self.__table.Controls.Add(label)
     self.__list = ListBox()
     self.__list.Width = 500
     self.__table.Dock = DockStyle.Fill
     try:
         for wd in watcher.controller.watchDirectories.itervalues():
             self.__list.Items.Add(wd)
     except Exception, e:
         self.__list.Items.Add(str(e))
コード例 #5
0
	def newPanel(self, x, y):
		panel = Panel()
		
		panel.Width = 5120
		panel.Height = 256*(len(self.roi_names)/2.)
		panel.Location = Point(x, y)
		panel.BorderStyle = BorderStyle.Fixed3D
		return panel
コード例 #6
0
ファイル: renamedialog.py プロジェクト: rachmatg/ironpython
    def initialiseButtons(self):
        buttonPanel = Panel()
        buttonPanel.Height = 23
        buttonPanel.Dock = DockStyle.Bottom
        buttonPanel.Width = 170

        acceptButton = Button()
        acceptButton.Text = "OK"
        acceptButton.DialogResult = DialogResult.OK
        acceptButton.Width = 75
        acceptButton.Dock = DockStyle.Left
        self.AcceptButton = acceptButton
        buttonPanel.Controls.Add(acceptButton)

        cancelButton = Button()
        cancelButton.Text = "Cancel"
        cancelButton.DialogResult = DialogResult.Cancel
        cancelButton.Width = 75
        cancelButton.Dock = DockStyle.Right
        self.CancelButton = cancelButton
        buttonPanel.Controls.Add(cancelButton)

        self.Controls.Add(buttonPanel)
コード例 #7
0
FORMBOXES = {}
FI = None

LOGGER.info("Booting viewport.")

window = Form()
window.Text = "tagme"
window.Name = "tagme"
window.Size = Size(500, 300)
window.FormBorderStyle = FormBorderStyle.FixedDialog

#  TOP LEVEL CONTROLS ###################
LOAD_AREA = Panel()
#LOAD_AREA.BorderStyle = BorderStyle.FixedSingle
LOAD_AREA.Width = window.ClientRectangle.Width
LOAD_AREA.Height = 20
LOAD_AREA.Dock = DockStyle.Top
window.Controls.Add(LOAD_AREA)

MUTATION_AREA = Panel()
MUTATION_AREA.Width = LOAD_AREA.Width
MUTATION_AREA.Height = LOAD_AREA.Height
#MUTATION_AREA.BorderStyle = BorderStyle.FixedSingle
MUTATION_AREA.Dock = DockStyle.Fill
#MUTATION_AREA.BackColor = Color.Red
window.Controls.Add(MUTATION_AREA)
#########################################

#  LOAD FILE CONTROLS ###################

LOAD_BUTTON = Button()
コード例 #8
0
ファイル: MainForm.py プロジェクト: madlinux/ironpython
    def _layout(self):
        upperPanel = Panel()
        upperPanel.Top = self.menuStrip.Height + self.PADDING
        upperPanel.Left = self.PADDING
        upperPanel.Width = self.ClientSize.Width - (2 * self.PADDING)
        upperPanel.Anchor = (AnchorStyles.Left |
                             AnchorStyles.Top |
                             AnchorStyles.Right)

        upperPanel.Controls.Add(self.postTextBox)
        upperPanel.Controls.Add(self.postButton)

        self.postTextBox.Left = 0
        self.postTextBox.Top = 0
        self.postTextBox.Width = (upperPanel.ClientSize.Width -
                                  self.postButton.Width -
                                  self.PADDING)
        self.postTextBox.Height *= 2
        self.postTextBox.Anchor = (AnchorStyles.Top |
                                   AnchorStyles.Left |
                                   AnchorStyles.Right)

        self.postButton.Left = self.postTextBox.Width + self.PADDING
        self.postButton.Top = 0
        self.postButton.Anchor = (AnchorStyles.Top |
                                 AnchorStyles.Right)

        upperPanel.Height = self.postTextBox.Height

        self.Controls.Add(upperPanel)

        lowerPanel = Panel()
        lowerPanel.Width = upperPanel.Width
        lowerPanel.Top = upperPanel.Top + upperPanel.Height + self.PADDING
        lowerPanel.Left = self.PADDING
        lowerPanel.Height = (self.ClientSize.Height -
                             lowerPanel.Top -
                             self.PADDING)
        lowerPanel.Anchor = (AnchorStyles.Top |
                             AnchorStyles.Left |
                             AnchorStyles.Right |
                             AnchorStyles.Bottom)

        self.friendsListBox.Top = 0
        self.friendsListBox.Left = 0
        self.friendsListBox.Anchor = (AnchorStyles.Top |
                                      AnchorStyles.Left |
                                      AnchorStyles.Bottom)
        self.friendsListBox.Height = lowerPanel.ClientSize.Height
        lowerPanel.Controls.Add(self.friendsListBox)

        self.tweetsPanel = Panel()
        self.tweetsPanel.BorderStyle = BorderStyle.FixedSingle
        self.tweetsPanel.Anchor = (AnchorStyles.Top |
                                   AnchorStyles.Left |
                                   AnchorStyles.Right |
                                   AnchorStyles.Bottom)
        self.tweetsPanel.AutoScroll = True
        self.tweetsPanel.Top = 0
        self.tweetsPanel.Left = self.friendsListBox.Width + self.PADDING
        self.tweetsPanel.Width = (lowerPanel.ClientSize.Width -
                                  self.tweetsPanel.Left)
        self.tweetsPanel.Height = lowerPanel.ClientSize.Height
        lowerPanel.Controls.Add(self.tweetsPanel)

        self.Controls.Add(lowerPanel)
コード例 #9
0
    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()
コード例 #10
0
    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

        #############-------------\-------------#############
        #logo file
        logo = PictureBox()
        logo.Image = logoFile
        ratio = float(logo.Height) / float(
            logo.Width
        )  #needs to be a float as int will round to the nearest whole number
        logo.Size = Size(
            uiWidth / 4, (uiHeight / 4) * ratio
        )  #scale the image by the ratio between the images height & width
        logo.Location = Point(spacing, (uiHeight - logo.Height) - spacing)
        logo.SizeMode = PictureBoxSizeMode.Zoom  # zooms the image to fit the extent
        logo.Anchor = (
            AnchorStyles.Bottom | AnchorStyles.Left
        )  #anchor styles lock elements to a given corner of the GUI if you allow users change size
        self.Controls.Add(logo)
        #logo.BorderStyle = BorderStyle.Fixed3D    #gives a border to the panel to test its location

        #############-------------\-------------#############

        #combox drop down
        cBox = ComboBox()  #dropdown control form
        cBox.Location = Point(spacing, uiHeight / 3)
        cBox.Width = uiWidth - (spacing * 2)
        cBox.Items.AddRange(
            listInput
        )  # Adds an array of items to the list of items for a ComboBox.
        cBox.DropDownStyle = ComboBoxStyle.DropDownList  #setting to dropdown list prevents users from being able to add aditional text values
        cBox.SelectedIndexChanged += self.dropDownOutput  #.Click+= registers the press of the button to register the event handler and determine what action takes place when button clicked
        self.Controls.Add(cBox)

        #############-------------\-------------#############

        #Create ok button
        btnOk = Button()  #create a button control
        btnOk.Text = "Next"
        btnOk.Location = Point(uiWidth - ((btnOk.Width * 2) + spacing),
                               uiHeight - (btnOk.Height + spacing))
        btnOk.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right)
        btnOk.Click += self.okButtonPressed  #Register the event on the button bress to trigger the def okButtonPressed
        self.Controls.Add(btnOk)

        #Create Cancel Button
        btnCancel = Button()
        #btnCancel.Parent = self
        btnCancel.Text = "Cancel"
        btnCancel.Location = Point(uiWidth - (btnOk.Width + spacing),
                                   uiHeight - (btnOk.Height + spacing))
        btnCancel.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right)
        btnCancel.Click += self.CnlButtonPressed
        self.Controls.Add(btnCancel)

        #############-------------\-------------#############

        #Create a weblink
        helplink = LinkLabel()
        helplink.Text = "User Guide"
        helplink.Tag = linkaddress  #tag is the web address
        helplink.Click += self.openLink  #register click event with event handler
        helplink.Location = Point(uiWidth - ((btnOk.Width * 3) + spacing),
                                  uiHeight - (btnOk.Height + 5))
        self.Controls.Add(helplink)
        helplink.Anchor = (AnchorStyles.Bottom | AnchorStyles.Left)

        colourPanel = Panel()
        colourPanel.Height = cBox.Height + spacing  #locate the panel behind the combo box.
        colourPanel.Width = uiWidth
        colourPanel.Location = Point(0, (uiHeight / 3) - 5)
        colourPanel.BorderStyle = BorderStyle.Fixed3D  # graphical style to pronounce the edge of the panel
        colourPanel.BackColor = Color.FromArgb(
            1, 125, 199)  #set background colour by RGB value
        self.Controls.Add(colourPanel)
コード例 #11
0
ファイル: MainForm.py プロジェクト: madlinux/ironpython
    def _layout(self):
        upperPanel = Panel()
        upperPanel.Top = self.menuStrip.Height + self.PADDING
        upperPanel.Left = self.PADDING
        upperPanel.Width = self.ClientSize.Width - (2 * self.PADDING)

        # Practical 1: add the Post button to the form's upper panel

        # Practical 2: uncomment each of the commented lines
        # below, and observe the effect of each on the application form

        # upperPanel.Anchor = (AnchorStyles.Left |
        #                      AnchorStyles.Top |
        #                      AnchorStyles.Right)

        upperPanel.Controls.Add(self.postTextBox)

        self.postTextBox.Left = 0
        self.postTextBox.Top = 0
        self.postTextBox.Width = (upperPanel.ClientSize.Width -
        #                           self.postButton.Width -
                                  self.PADDING)
        self.postTextBox.Height *= 2
        # self.postTextBox.Anchor = (AnchorStyles.Top |
        #                            AnchorStyles.Left |
        #                            AnchorStyles.Right)

        # self.postButton.Left = self.postTextBox.Width + self.PADDING
        # self.postButton.Top = 0
        # self.postButton.Anchor = (AnchorStyles.Top |
        #                          AnchorStyles.Right)

        upperPanel.Height = self.postTextBox.Height

        self.Controls.Add(upperPanel)

        lowerPanel = Panel()
        lowerPanel.Width = upperPanel.Width
        lowerPanel.Top = upperPanel.Top + upperPanel.Height + self.PADDING
        lowerPanel.Left = self.PADDING
        lowerPanel.Height = (self.ClientSize.Height -
                             lowerPanel.Top -
                             self.PADDING)
        lowerPanel.Anchor = (AnchorStyles.Top |
                             AnchorStyles.Left |
                             AnchorStyles.Right |
                             AnchorStyles.Bottom)

        self.friendsListBox.Top = 0
        self.friendsListBox.Left = 0
        self.friendsListBox.Anchor = (AnchorStyles.Top |
                                      AnchorStyles.Left |
                                      AnchorStyles.Bottom)
        self.friendsListBox.Height = lowerPanel.ClientSize.Height
        lowerPanel.Controls.Add(self.friendsListBox)

        self.tweetsPanel = Panel()
        self.tweetsPanel.BorderStyle = BorderStyle.FixedSingle
        self.tweetsPanel.Anchor = (AnchorStyles.Top |
                                   AnchorStyles.Left |
                                   AnchorStyles.Right |
                                   AnchorStyles.Bottom)
        self.tweetsPanel.AutoScroll = True
        self.tweetsPanel.Top = 0
        self.tweetsPanel.Left = self.friendsListBox.Width + self.PADDING
        self.tweetsPanel.Width = (lowerPanel.ClientSize.Width -
                                  self.tweetsPanel.Left)
        self.tweetsPanel.Height = lowerPanel.ClientSize.Height
        lowerPanel.Controls.Add(self.tweetsPanel)

        self.Controls.Add(lowerPanel)