def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        self.parent = parent

        ItemSize = (100, 100)
        wblue = ColWin(self, wx.ID_ANY, wx.BLUE)
        wblue.SetSize(ItemSize)
        wred = ColWin(self, wx.ID_ANY, wx.RED)
        wred.SetSize(ItemSize)

        hsizer1 = wx.BoxSizer(wx.HORIZONTAL)
        b = 0
        hsizer1.AddStretchSpacer()
        hsizer1.Add(wblue, 0, wx.ALL, b)
        hsizer1.AddStretchSpacer()
        hsizer1.Add(wred, 0, wx.ALL, b)
        hsizer1.AddStretchSpacer()

        vsizer1 = wx.BoxSizer(wx.VERTICAL)
        b = 0
        vsizer1.AddStretchSpacer()
        vsizer1.Add(hsizer1, 0, wx.EXPAND | wx.ALL, b)
        vsizer1.AddStretchSpacer()

        self.SetSizer(vsizer1)
        self.parent.SetClientSize((400, 400))
        self.parent.CenterOnScreen()
Example #2
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        self.parent = parent

        ItemSize = (200, 100)

        wblue2 = ColWin(self, wx.ID_ANY, wx.BLUE)
        wblue2.SetSize(ItemSize)

        hgap, vgap = 0, 0
        nrows, ncols = 3, 3
        fgs = wx.FlexGridSizer(nrows, ncols, hgap, vgap)
        b = 0
        fgs.AddMany([
            (-1, -1),
            (-1, -1),
            (-1, -1),
            (-1, -1),
            (wblue2, 0, wx.ALL, b),
            (-1, -1),
            (-1, -1),
            (-1, -1),
            (-1, -1),
        ])

        fgs.AddGrowableRow(0)
        fgs.AddGrowableRow(2)
        fgs.AddGrowableCol(0)
        fgs.AddGrowableCol(2)

        self.SetSizer(fgs)

        self.parent.SetSize((500, 400))
        self.parent.CentreOnScreen()
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        self.parent = parent

        ItemSize = (200, 100)
        wblue2 = ColWin(self, wx.ID_ANY, wx.BLUE)
        wblue2.SetSize(ItemSize)

        hsizer1 = wx.BoxSizer(wx.HORIZONTAL)
        b = 0
        hsizer1.AddStretchSpacer()
        hsizer1.Add(wblue2, 0, wx.ALIGN_CENTER | wx.ALL, b)
        hsizer1.AddStretchSpacer()

        self.SetSizer(hsizer1)
        self.parent.SetClientSize((400, 400))
        self.parent.CenterOnScreen()
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        self.parent = parent

        ItemSize = (200, 100)
        wblue2 = ColWin(self, wx.ID_ANY, wx.BLUE)
        #A item (ColWin) with a fixed size
        wblue2.SetSize(ItemSize)

        vsizer1 = wx.BoxSizer(wx.VERTICAL)
        b = 0
        vsizer1.AddStretchSpacer()
        #~ vsizer1.Add((-1, -1), 1) #old
        #centered
        vsizer1.Add(wblue2, 0, wx.ALIGN_CENTER | wx.ALL, b)
        vsizer1.AddStretchSpacer()
        #~ vsizer1.Add((-1, -1), 1) #old

        self.SetSizer(vsizer1)
        self.parent.SetClientSize((400, 400))
        self.parent.CenterOnScreen()
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        self.parent = parent

        wred = ColWin(self, wx.ID_ANY, wx.RED)
        #The a width is fixed at 200 pix
        wred.SetSize((200, -1))
        wblue = ColWin(self, wx.ID_ANY, wx.BLUE)
        wgreen = ColWin(self, wx.ID_ANY, wx.GREEN)

        b = 4

        vsizer1 = wx.BoxSizer(wx.VERTICAL)
        vsizer1.Add(wblue, 1, wx.EXPAND | wx.BOTTOM, b)
        vsizer1.Add(wgreen, 2, wx.EXPAND, b)

        hsizer1 = wx.BoxSizer(wx.HORIZONTAL)
        hsizer1.Add(wred, 0, wx.GROW | wx.LEFT | wx.TOP | wx.BOTTOM, b)
        hsizer1.Add(vsizer1, 1, wx.EXPAND | wx.ALL, b)

        self.SetSizerAndFit(hsizer1)
        self.parent.SetClientSize((500, 400))
        self.parent.SetMinSize((250, 100))
        self.parent.CenterOnScreen()
Example #6
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent, wx.ID_ANY)
        self.parent = parent

        #the widgets

        wsize = (16, 16)
        wgreen = ColWin(self, wx.ID_ANY, wx.GREEN)
        wgreen.SetSize(wsize)
        wred = ColWin(self, wx.ID_ANY, wx.RED)
        wred.SetSize(wsize)
        wblue = ColWin(self, wx.ID_ANY, wx.BLUE)
        wblue.SetSize(wsize)
        wblack = ColWin(self, wx.ID_ANY, wx.BLACK)
        wblack.SetSize(wsize)
        wyellow = ColWin(self, wx.ID_ANY, (255, 255, 0))
        wyellow.SetSize(wsize)
        
        title = wx.StaticText(self, wx.ID_ANY, 'HALOGENE (atomic mass)')

        label1 = wx.StaticText(self, wx.ID_ANY, 'Flurorine')
        txt1 = wx.TextCtrl(self, wx.ID_ANY,'18.9984 g/mol')
 
        label2 = wx.StaticText(self, wx.ID_ANY, 'Chlorine')
        txt2 = wx.TextCtrl(self, wx.ID_ANY,'more than fluorine')
 
        label3 = wx.StaticText(self, wx.ID_ANY, 'Bromine')
        txt3 = wx.TextCtrl(self, wx.ID_ANY, 'more than chlorine')
 
        label4 = wx.StaticText(self, wx.ID_ANY, 'Iodine')
        txt4 = wx.TextCtrl(self, wx.ID_ANY, 'more than bromine')

        label5 = wx.StaticText(self, wx.ID_ANY, 'Astatine')
        txt5 = wx.TextCtrl(self, wx.ID_ANY, 'less than radon !')

        but1 = wx.Button(self, wx.ID_ANY, 'OK')
        but2 = wx.Button(self, wx.ID_ANY, 'Cancel')

        staline1 = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, (-1, 2), \
                        wx.LI_HORIZONTAL)
        staline2 = wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, (-1, 2), \
                        wx.LI_HORIZONTAL)

        #the sizers

        hsizer1 = wx.BoxSizer(wx.HORIZONTAL)
        b = 5
        hsizer1.Add(title, 0)
        
        hsizer2 = wx.BoxSizer(wx.HORIZONTAL)
        b = 5
        hsizer2.Add(but1, 0, wx.RIGHT, b)
        hsizer2.Add(but2, 0)
        
        fgs = wx.FlexGridSizer(rows=5, cols=3, hgap=5, vgap=5)
        f1 = wx.ALL | wx.ALIGN_CENTRE_VERTICAL
        f2 = wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_CENTRE_VERTICAL
        f3 = wx.ALL | wx.EXPAND
        b = 0
        fgs.AddMany([(wgreen, 0, f1, b),
                     (label1, 0, f2, b),
                     (txt1, 0, f3, b),
                     
                     (wred, 0, f1, b),
                     (label2, 0, f2, b),
                     (txt2, 0, f3, b),
                     
                     (wblue, 0, f1, b),
                     (label3, 0, f2, b),
                     (txt3, 0, f3, b),

                     (wblack, 0, f1, b),
                     (label4, 0, f2, b),
                     (txt4, 0, f3, b),
                     
                     (wyellow, 0, f1, b),
                     (label5, 0, f2, b),
                     (txt5, 0, f3, b),
                    ])
        fgs.AddGrowableCol(2)

        vsizer1 = wx.BoxSizer(wx.VERTICAL)
        b = 10
        vsizer1.Add(hsizer1, 0, wx.TOP | wx.CENTER, b)
        vsizer1.Add(staline1, 0, wx.ALL | wx.EXPAND, b)
        vsizer1.Add(fgs, 0, wx.LEFT | wx.RIGHT | wx.CENTRE | wx.EXPAND, b*4)
        vsizer1.Add(staline2, 0, wx.ALL | wx.EXPAND, b)
        vsizer1.Add(hsizer2, 0, wx.BOTTOM | wx.CENTER, b)
         
        #set the size and lock the frame size
        
        self.SetSizerAndFit(vsizer1)
        self.parent.SetClientSize(vsizer1.GetSize())
        r = self.parent.GetSize()
        self.parent.SetMaxSize((-1, r[1]))
        self.parent.SetMinSize((r[0], r[1]))
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        self.parent = parent

        #widgets
        lab1 = wx.StaticText(self,
                             wx.ID_ANY,
                             'hydrogen :',
                             style=wx.ALIGN_RIGHT)
        lab2 = wx.StaticText(self, wx.ID_ANY, 'tin :', style=wx.ALIGN_RIGHT)
        s = ('mendelevium -- ' * 3).rstrip('- ') + ' :'
        lab3 = wx.StaticText(self, wx.ID_ANY, s, style=wx.ALIGN_RIGHT)
        lab4 = wx.StaticText(self, wx.ID_ANY, 'carbon :', style=wx.ALIGN_RIGHT)
        lab5 = wx.StaticText(self,
                             wx.ID_ANY,
                             'nitrogen :',
                             style=wx.ALIGN_RIGHT)
        lab6 = wx.StaticText(self, wx.ID_ANY, 'argon :', style=wx.ALIGN_RIGHT)
        lab7 = wx.StaticText(self, wx.ID_ANY, 'iron :', style=wx.ALIGN_RIGHT)
        lab8 = wx.StaticText(self, wx.ID_ANY, 'gold :', style=wx.ALIGN_RIGHT)
        txt1 = wx.TextCtrl(self, wx.ID_ANY, '')
        txt2 = wx.TextCtrl(self, wx.ID_ANY, '')
        txt3 = wx.TextCtrl(self, wx.ID_ANY, '')
        txt4 = wx.TextCtrl(self, wx.ID_ANY, '')
        txt5 = wx.TextCtrl(self, wx.ID_ANY, '')
        txt6 = wx.TextCtrl(self, wx.ID_ANY, '')
        txt7 = wx.TextCtrl(self, wx.ID_ANY, '')
        txt8 = wx.TextCtrl(self, wx.ID_ANY, '')

        lab0 = wx.StaticText(self,
                             wx.ID_ANY,
                             'A few chemical elements',
                             style=wx.ALIGN_CENTER)
        lab0.SetBackgroundColour('#f0f0f0')
        lab0.SetForegroundColour(wx.RED)
        tmpfo = lab0.GetFont()
        tmpfo.SetPointSize(int(tmpfo.GetPointSize() * 1.5))
        lab0.SetFont(tmpfo)

        wblue = ColWin(self, wx.ID_ANY, wx.BLUE)
        wyellow = ColWin(self, wx.ID_ANY, '#ffff00')
        h = 50
        wblue.SetSize((-1, h))
        wyellow.SetSize((-1, h))

        vgap, hgap = 4, 10
        gbs1 = wx.GridBagSizer(vgap, hgap)

        b = 0
        gbs1.Add(lab0, (0, 0), (1, 2), wx.EXPAND, b),

        gbs1.Add(lab1, (1, 0), (1, 1), wx.EXPAND | wx.ALL, b)
        gbs1.Add(txt1, (1, 1), (1, 1), wx.EXPAND | wx.ALL, b)

        gbs1.Add(lab2, (2, 0), (1, 1), wx.EXPAND | wx.ALL, b)
        gbs1.Add(txt2, (2, 1), (1, 1), wx.EXPAND | wx.ALL, b)

        gbs1.Add(lab3, (3, 0), (1, 1), wx.EXPAND | wx.ALL, b)
        gbs1.Add(txt3, (3, 1), (1, 1), wx.EXPAND | wx.ALL, b)

        gbs1.Add(lab4, (4, 0), (1, 1), wx.EXPAND | wx.ALL, b)
        gbs1.Add(txt4, (4, 1), (1, 1), wx.EXPAND | wx.ALL, b)

        gbs1.Add(lab5, (5, 0), (1, 1), wx.EXPAND | wx.ALL, b)
        gbs1.Add(txt5, (5, 1), (1, 1), wx.EXPAND | wx.ALL, b)

        gbs1.Add(lab6, (6, 0), (1, 1), wx.EXPAND | wx.ALL, b)
        gbs1.Add(txt6, (6, 1), (1, 1), wx.EXPAND | wx.ALL, b)

        gbs1.Add(lab7, (7, 0), (1, 1), wx.EXPAND | wx.ALL, b)
        gbs1.Add(txt7, (7, 1), (1, 1), wx.EXPAND | wx.ALL, b)

        gbs1.Add(lab8, (8, 0), (1, 1), wx.EXPAND | wx.ALL, b)
        gbs1.Add(txt8, (8, 1), (1, 1), wx.EXPAND | wx.ALL, b)

        b = 10
        hsizer1 = wx.BoxSizer(wx.HORIZONTAL)
        hsizer1.AddStretchSpacer()
        hsizer1.Add(gbs1, 0, wx.TOP | wx.BOTTOM, b)
        hsizer1.AddStretchSpacer()

        b = 0
        vsizer1 = wx.BoxSizer(wx.VERTICAL)
        vsizer1.Add(wblue, 0, wx.GROW | wx.ALL, b)
        vsizer1.SetItemMinSize(wblue, (600, -1))
        vsizer1.Add(hsizer1, 0, wx.EXPAND | wx.ALL, b)
        vsizer1.Add(wyellow, 0, wx.GROW | wx.ALL, b)

        self.SetSizerAndFit(vsizer1)
        self.parent.SetClientSize(vsizer1.GetSize())
Example #8
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        self.parent = parent

        #widgets
        lab1 = wx.StaticText(self,
                             wx.ID_ANY,
                             'hydrogen :',
                             style=wx.ALIGN_RIGHT)
        lab2 = wx.StaticText(self, wx.ID_ANY, 'tin :', style=wx.ALIGN_RIGHT)
        s = ('mendelevium -- ' * 3).rstrip('- ') + ' :'
        lab3 = wx.StaticText(self, wx.ID_ANY, s, style=wx.ALIGN_RIGHT)
        lab4 = wx.StaticText(self, wx.ID_ANY, 'carbon :', style=wx.ALIGN_RIGHT)
        lab5 = wx.StaticText(self,
                             wx.ID_ANY,
                             'nitrogen :',
                             style=wx.ALIGN_RIGHT)
        lab6 = wx.StaticText(self, wx.ID_ANY, 'argon :', style=wx.ALIGN_RIGHT)
        lab7 = wx.StaticText(self, wx.ID_ANY, 'iron :', style=wx.ALIGN_RIGHT)
        lab8 = wx.StaticText(self, wx.ID_ANY, 'gold :', style=wx.ALIGN_RIGHT)
        txt1 = wx.TextCtrl(self, wx.ID_ANY, '')
        txt2 = wx.TextCtrl(self, wx.ID_ANY, '')
        txt3 = wx.TextCtrl(self, wx.ID_ANY, '')
        txt4 = wx.TextCtrl(self, wx.ID_ANY, '')
        txt5 = wx.TextCtrl(self, wx.ID_ANY, '')
        txt6 = wx.TextCtrl(self, wx.ID_ANY, '')
        txt7 = wx.TextCtrl(self, wx.ID_ANY, '')
        txt8 = wx.TextCtrl(self, wx.ID_ANY, '')

        wblue = ColWin(self, wx.ID_ANY, wx.BLUE)
        wyellow = ColWin(self, wx.ID_ANY, '#ffff00')
        h = 50
        wblue.SetSize((-1, h))
        wyellow.SetSize((-1, h))

        hgap, vgap = 10, 6
        nrows, ncols = 8, 2
        fgs1 = wx.FlexGridSizer(nrows, ncols, hgap, vgap)
        fgs1.AddMany([
            (lab1, 1, wx.EXPAND | wx.ALL),
            (txt1, 1, wx.EXPAND | wx.ALL),
            (lab2, 1, wx.EXPAND | wx.ALL),
            (txt2, 1, wx.EXPAND | wx.ALL),
            (lab3, 1, wx.EXPAND | wx.ALL),
            (txt3, 1, wx.EXPAND | wx.ALL),
            (lab4, 1, wx.EXPAND | wx.ALL),
            (txt4, 1, wx.EXPAND | wx.ALL),
            (lab5, 1, wx.EXPAND | wx.ALL),
            (txt5, 1, wx.EXPAND | wx.ALL),
            (lab6, 1, wx.EXPAND | wx.ALL),
            (txt6, 1, wx.EXPAND | wx.ALL),
            (lab7, 1, wx.EXPAND | wx.ALL),
            (txt7, 1, wx.EXPAND | wx.ALL),
            (lab8, 1, wx.EXPAND | wx.ALL),
            (txt8, 1, wx.EXPAND | wx.ALL),
        ])

        b = 10
        hsizer1 = wx.BoxSizer(wx.HORIZONTAL)
        hsizer1.AddStretchSpacer()
        hsizer1.Add(fgs1, 0, wx.TOP | wx.BOTTOM, b)
        hsizer1.AddStretchSpacer()

        b = 0
        vsizer1 = wx.BoxSizer(wx.VERTICAL)
        vsizer1.Add(wblue, 0, wx.GROW | wx.ALL, b)
        vsizer1.SetItemMinSize(wblue, (600, -1))
        vsizer1.Add(hsizer1, 0, wx.EXPAND | wx.ALL, b)
        vsizer1.Add(wyellow, 0, wx.GROW | wx.ALL, b)

        self.SetSizerAndFit(vsizer1)
        self.parent.SetClientSize(vsizer1.GetSize())