예제 #1
0
    def __init__(self,
                 parent,
                 msg,
                 caption,
                 pos=wx.DefaultPosition,
                 size=(500, 300),
                 style=wx.DEFAULT_DIALOG_STYLE):
        wx.Dialog.__init__(self, parent, -1, caption, pos, size, style)
        x, y = pos
        if x == -1 and y == -1:
            self.CenterOnScreen(wx.BOTH)

        self.text = text = wx.TextCtrl(self,
                                       -1,
                                       msg,
                                       style=wx.TE_MULTILINE | wx.TE_READONLY)

        ok = wx.Button(self, wx.ID_OK, "OK")
        ok.SetDefault()
        lc = layoutf.Layoutf('t=t5#1;b=t5#2;l=l5#1;r=r5#1', (self, ok))
        text.SetConstraints(lc)

        lc = layoutf.Layoutf('b=b5#1;x%w50#1;w!80;h*', (self, ))
        ok.SetConstraints(lc)
        self.SetAutoLayout(1)
        self.Layout()
예제 #2
0
    def __init__(self,
                 parent,
                 msg,
                 caption,
                 pos=wx.DefaultPosition,
                 size=(500, 300),
                 style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER):
        # Notice, that style can be overrriden in the caller.
        wx.Dialog.__init__(self, parent, -1, caption, pos, size, style)
        x, y = pos
        if x == -1 and y == -1:
            self.CenterOnScreen(wx.BOTH)

        text = wx.TextCtrl(self,
                           -1,
                           msg,
                           style=wx.TE_MULTILINE | wx.TE_READONLY)
        ok = wx.Button(self, wx.ID_OK, "OK")

        # Mysterious constraint layouts from
        # https://www.wxpython.org/docs/api/wx.lib.layoutf.Layoutf-class.html
        lc = layoutf.Layoutf('t=t5#1;b=t5#2;l=l5#1;r=r5#1', (self, ok))
        text.SetConstraints(lc)
        lc = layoutf.Layoutf('b=b5#1;x%w50#1;w!80;h!25', (self, ))
        ok.SetConstraints(lc)

        self.SetAutoLayout(1)
        self.Layout()
예제 #3
0
    def __init__(self, parent, msg, caption, FF=True, fsize = 10, icon = None,
                 pos=(-1,-1) , size=(500,300),
                 style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | \
                 wx.MAXIMIZE_BOX | wx.MINIMIZE_BOX | \
                 wx.FULL_REPAINT_ON_RESIZE):

        wx.Dialog.__init__(self, parent, -1, caption, pos, size, style)
        if icon:
            self.SetIcon(icon.GetIcon())
        # always center on screen
        self.CenterOnScreen(wx.BOTH)
        self.text = text = wx.TextCtrl(self,
                                       -1,
                                       msg,
                                       style=wx.TE_MULTILINE | wx.TE_READONLY)
        # default 10-point fixed font (DejaVu Sans Mono)
        if FF:
            self.text.SetFont(
                wx.Font(fsize, wx.MODERN, wx.NORMAL, wx.NORMAL, 0,
                        "DejaVu Sans Mono"))
        else:
            self.text.SetFont(
                wx.Font(fsize, wx.MODERN, wx.NORMAL, wx.NORMAL, 0, "Calibri"))

        ok = wx.Button(self, wx.ID_OK, "OK")
        lc = layoutf.Layoutf('t=t5#1;b=t5#2;l=l5#1;r=r5#1', (self, ok))
        text.SetConstraints(lc)

        lc = layoutf.Layoutf('b=b5#1;x%w50#1;w!80;h*', (self, ))
        ok.SetConstraints(lc)
        ok.SetDefault()
        self.SetAutoLayout(1)
        self.Layout()
예제 #4
0
    def __init__(self, parent):
        wx.Panel.__init__(self, parent, -1)

        self.SetAutoLayout(True)
        self.Bind(wx.EVT_BUTTON, self.OnButton)

        self.panelA = wx.Window(self, -1, style=wx.SIMPLE_BORDER)
        self.panelA.SetBackgroundColour(wx.BLUE)
        self.panelA.SetConstraints(
            layoutf.Layoutf('t=t10#1;l=l10#1;b=b10#1;r%r50#1', (self, )))

        self.panelB = wx.Window(self, -1, style=wx.SIMPLE_BORDER)
        self.panelB.SetBackgroundColour(wx.RED)
        self.panelB.SetConstraints(
            layoutf.Layoutf('t=t10#1;r=r10#1;b%b30#1;l>10#2',
                            (self, self.panelA)))

        self.panelC = wx.Window(self, -1, style=wx.SIMPLE_BORDER)
        self.panelC.SetBackgroundColour(wx.WHITE)
        self.panelC.SetConstraints(
            layoutf.Layoutf('t_10#3;r=r10#1;b=b10#1;l>10#2',
                            (self, self.panelA, self.panelB)))

        b = wx.Button(self.panelA, -1, ' Panel A ')
        b.SetConstraints(
            layoutf.Layoutf('X=X#1;Y=Y#1;h*;w%w50#1', (self.panelA, )))

        b = wx.Button(self.panelB, -1, ' Panel B ')
        b.SetConstraints(
            layoutf.Layoutf('t=t2#1;r=r4#1;h*;w*', (self.panelB, )))

        self.panelD = wx.Window(self.panelC, -1, style=wx.SIMPLE_BORDER)
        self.panelD.SetBackgroundColour(wx.GREEN)
        self.panelD.SetConstraints(
            layoutf.Layoutf('b%h50#1;r%w50#1;h=h#2;w=w#2', (self.panelC, b)))

        b = wx.Button(self.panelC, -1, ' Panel C ')
        b.SetConstraints(layoutf.Layoutf('t_#1;l>#1;h*;w*', (self.panelD, )))

        wx.StaticText(self.panelD, -1, "Panel D",
                      (4, 4)).SetBackgroundColour(wx.GREEN)