button panel's close

Hi all.
i 've used wx.aui.Manager to manage three panels.
How do I disable the button of closing of each panel?
I do not want that each panel can be closed

Here's' my code:

import wx
import wx.aui
import wx.lib.flatnotebook
class MyFrame(wx.Frame):
    def __init__(self, *args, **kwargs):
        wx.Frame.__init__(self, None,
title='TITLE_FRAME',size=(700,600),pos=(0,0))

        self.mgr = wx.aui.AuiManager(self)

        leftpanel = wx.Panel(self, -1, size = (400, 300),style=wx.BORDER)

        rightpanel = wx.Panel(self, -1, size = (400, 300))

        # -> inizializzazione notebookGrid
        notebookGrid =
wx.lib.flatnotebook.FlatNotebook(leftpanel,-1,style=wx.NB_FIXEDWIDTH|wx.NB_MULTILINE)
        notebookGrid.AddPage(None, '',select=True)
        sizer = wx.BoxSizer()
        sizer.Add(notebookGrid,1, wx.EXPAND, 5)
        leftpanel.SetSizer(sizer)
        # -> fine
        panelGrid = wx.Panel(self, -1)

        notebookGrid.AddPage(panelGrid, 'tab',select=True)

        bottompanel = wx.Panel(self, -1, size = (400, 300))

        # -> inizializzazione notebookGrid
        notebook =
wx.lib.flatnotebook.FlatNotebook(bottompanel,-1,style=wx.NB_FIXEDWIDTH|wx.NB_MULTILINE)
        notebook.AddPage(None, '',select=True)
        sizer = wx.BoxSizer()
        sizer.Add(notebook,1, wx.EXPAND, 5)
        bottompanel.SetSizer(sizer)
        # -> fine

        panelBottom = wx.Panel(self, -1)
        notebook.AddPage(panelBottom, 'bottom',select=True)

        self.mgr.AddPane(leftpanel, wx.aui.AuiPaneInfo().Bottom())
        self.mgr.AddPane(rightpanel, wx.aui.AuiPaneInfo().Left().Layer(1))
        self.mgr.AddPane(bottompanel, wx.aui.AuiPaneInfo().Center().Layer(2))

        self.mgr.Update()

class MyApp(wx.App):
    def OnInit(self):
        frame = MyFrame(None, -1, '07_wxaui.py')
        frame.Show()
        self.SetTopWindow(frame)
        return 1

if __name__ == "__main__":
    app = MyApp(0)
    app.MainLoop()

thanks in advanced

···

--
Fabio

Hey there,

You may wish to try the following which should hopefully do what you want:

   self.mgr.AddPane(leftpanel, wx.aui.AuiPaneInfo().Bottom().CloseButton(False))
   self.mgr.AddPane(rightpanel, wx.aui.AuiPaneInfo().Left().Layer(1).CloseButton(False))
   self.mgr.AddPane(bottompanel, wx.aui.AuiPaneInfo().Center().Layer(2).CloseButton(False))
···

On Thu, Jul 16, 2009 at 4:42 PM, Fabio Spadaro fabiolinospad@gmail.com wrote:

Hi all.

i 've used wx.aui.Manager to manage three panels.

How do I disable the button of closing of each panel?

I do not want that each panel can be closed

Here’s’ my code:

import wx

import wx.aui

import wx.lib.flatnotebook

class MyFrame(wx.Frame):

def __init__(self, *args, **kwargs):

    wx.Frame.__init__(self, None,

title=‘TITLE_FRAME’,size=(700,600),pos=(0,0))

    self.mgr = wx.aui.AuiManager(self)



    leftpanel = wx.Panel(self, -1, size = (400, 300),style=wx.BORDER)





    rightpanel = wx.Panel(self, -1, size = (400, 300))



    # -> inizializzazione notebookGrid

    notebookGrid =

wx.lib.flatnotebook.FlatNotebook(leftpanel,-1,style=wx.NB_FIXEDWIDTH|wx.NB_MULTILINE)

    notebookGrid.AddPage(None, '',select=True)

    sizer = wx.BoxSizer()

    sizer.Add(notebookGrid,1, wx.EXPAND, 5)

    leftpanel.SetSizer(sizer)

    # -> fine

    panelGrid = wx.Panel(self, -1)



    notebookGrid.AddPage(panelGrid, 'tab',select=True)



    bottompanel = wx.Panel(self, -1, size = (400, 300))



    # -> inizializzazione notebookGrid

    notebook =

wx.lib.flatnotebook.FlatNotebook(bottompanel,-1,style=wx.NB_FIXEDWIDTH|wx.NB_MULTILINE)

    notebook.AddPage(None, '',select=True)

    sizer = wx.BoxSizer()

    sizer.Add(notebook,1, wx.EXPAND, 5)

    bottompanel.SetSizer(sizer)

    # -> fine



    panelBottom = wx.Panel(self, -1)

    notebook.AddPage(panelBottom, 'bottom',select=True)



    self.mgr.AddPane(leftpanel, wx.aui.AuiPaneInfo().Bottom())

    self.mgr.AddPane(rightpanel, wx.aui.AuiPaneInfo().Left().Layer(1))

    self.mgr.AddPane(bottompanel, wx.aui.AuiPaneInfo().Center().Layer(2))



    self.mgr.Update()

class MyApp(wx.App):

def OnInit(self):

    frame = MyFrame(None, -1, '07_wxaui.py')

    frame.Show()

    self.SetTopWindow(frame)

    return 1

if name == “main”:

app = MyApp(0)

app.MainLoop()

thanks in advanced

Fabio

Tanks. It does work.
  
excuse me if I go OT but I would like to block the
SPLITTER_SASH_POS_CHANGING ' event but does not work:

def __init__(self, *args, **kwargs):
    wx.Frame.__init__(self, None, title='TITLE_FRAME',size=(700,600),pos=(0,0))
...
    self.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGING, self.onSplitterSashPosChanging)
...
def onSplitterSashPosChanging(self,evt):
     evt.Veto() #

···

2009/7/17 Mikael Norgren <that1swede@gmail.com>:

Hey there,

You may wish to try the following which should hopefully do what you want:

   self\.mgr\.AddPane\(leftpanel,

wx.aui.AuiPaneInfo().Bottom().CloseButton(False))
self.mgr.AddPane(rightpanel,
wx.aui.AuiPaneInfo().Left().Layer(1).CloseButton(False))
self.mgr.AddPane(bottompanel,
wx.aui.AuiPaneInfo().Center().Layer(2).CloseButton(False))

On Thu, Jul 16, 2009 at 4:42 PM, Fabio Spadaro <fabiolinospad@gmail.com> > wrote:

Hi all.
i 've used wx.aui.Manager to manage three panels.
How do I disable the button of closing of each panel?
I do not want that each panel can be closed

Here's' my code:

import wx
import wx.aui
import wx.lib.flatnotebook
class MyFrame(wx.Frame):
def __init__(self, *args, **kwargs):
wx.Frame.__init__(self, None,
title='TITLE_FRAME',size=(700,600),pos=(0,0))

   self\.mgr = wx\.aui\.AuiManager\(self\)

   leftpanel = wx\.Panel\(self, \-1, size = \(400, 300\),style=wx\.BORDER\)

   rightpanel = wx\.Panel\(self, \-1, size = \(400, 300\)\)

   \# \-&gt; inizializzazione notebookGrid
   notebookGrid =

wx.lib.flatnotebook.FlatNotebook(leftpanel,-1,style=wx.NB_FIXEDWIDTH|wx.NB_MULTILINE)
notebookGrid.AddPage(None, '',select=True)
sizer = wx.BoxSizer()
sizer.Add(notebookGrid,1, wx.EXPAND, 5)
leftpanel.SetSizer(sizer)
# -> fine
panelGrid = wx.Panel(self, -1)

   notebookGrid\.AddPage\(panelGrid, &#39;tab&#39;,select=True\)

   bottompanel = wx\.Panel\(self, \-1, size = \(400, 300\)\)

   \# \-&gt; inizializzazione notebookGrid
   notebook =

wx.lib.flatnotebook.FlatNotebook(bottompanel,-1,style=wx.NB_FIXEDWIDTH|wx.NB_MULTILINE)
notebook.AddPage(None, '',select=True)
sizer = wx.BoxSizer()
sizer.Add(notebook,1, wx.EXPAND, 5)
bottompanel.SetSizer(sizer)
# -> fine

   panelBottom = wx\.Panel\(self, \-1\)
   notebook\.AddPage\(panelBottom, &#39;bottom&#39;,select=True\)

   self\.mgr\.AddPane\(leftpanel, wx\.aui\.AuiPaneInfo\(\)\.Bottom\(\)\)
   self\.mgr\.AddPane\(rightpanel, wx\.aui\.AuiPaneInfo\(\)\.Left\(\)\.Layer\(1\)\)
   self\.mgr\.AddPane\(bottompanel,

wx.aui.AuiPaneInfo().Center().Layer(2))

   self\.mgr\.Update\(\)

class MyApp(wx.App):
def OnInit(self):
frame = MyFrame(None, -1, '07_wxaui.py')
frame.Show()
self.SetTopWindow(frame)
return 1

if __name__ == "__main__":
app = MyApp(0)
app.MainLoop()

thanks in advanced
--
Fabio

>

--
Fabio Spadaro
www.fabiospadaro.com

Not all events can be vetoed. If what you are aiming at is just to fix
the size of some panes so that user can not change it by dragging the
sash, just call Fixed() for the AuiPaneInfo like this:

self.mgr.AddPane(leftpanel, wx.aui.AuiPaneInfo().Bottom().Fixed())

···

On Jul 17, 6:23 pm, Fabio Spadaro <fabiolinos...@gmail.com> wrote:

Tanks. It does work.

excuse me if I go OT but I would like to block the
SPLITTER_SASH_POS_CHANGING ' event but does not work:

def __init__(self, *args, **kwargs):
wx.Frame.__init__(self, None, title='TITLE_FRAME',size=(700,600),pos=(0,0))
...
self.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGING, self.onSplitterSashPosChanging)
...
def onSplitterSashPosChanging(self,evt):
evt.Veto() #

Hi.
but do both? (CloseButton(False) & Fixed()).

how is it do?

···

2009/7/17 Hong Yuan <hongyuan1306@gmail.com>:

On Jul 17, 6:23 pm, Fabio Spadaro <fabiolinos...@gmail.com> wrote:

Tanks. It does work.

excuse me if I go OT but I would like to block the
SPLITTER_SASH_POS_CHANGING ' event but does not work:

def __init__(self, *args, **kwargs):
wx.Frame.__init__(self, None, title='TITLE_FRAME',size=(700,600),pos=(0,0))
...
self.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGING, self.onSplitterSashPosChanging)
...
def onSplitterSashPosChanging(self,evt):
evt.Veto() #

Not all events can be vetoed. If what you are aiming at is just to fix
the size of some panes so that user can not change it by dragging the
sash, just call Fixed() for the AuiPaneInfo like this:

self.mgr.AddPane(leftpanel, wx.aui.AuiPaneInfo().Bottom().Fixed())

>

--
Fabio Spadaro
www.fabiospadaro.com

Because almost all methods of an AuiPaneInfo instance returns it self,
you simple connect all the calls with a dot, like:

self.mgr.AddPane(leftpanel, wx.aui.AuiPaneInfo().Bottom().CloseButton
(False).Fixed())

···

On Jul 17, 7:48 pm, Fabio Spadaro <fabiolinos...@gmail.com> wrote:

Hi.
but do both? (CloseButton(False) & Fixed()).

how is it do?

works ok but I can not understand how to shape the layout.
I would like to have a panel on the left and 2 panels on the right.
The 2 panels on the right must be the same size.
Now the 2 right panels are different sizes.
How is it does?
Thanks for your help.

···

2009/7/17 Hong Yuan <hongyuan1306@gmail.com>:

On Jul 17, 7:48 pm, Fabio Spadaro <fabiolinos...@gmail.com> wrote:

Hi.
but do both? (CloseButton(False) & Fixed()).

how is it do?

Because almost all methods of an AuiPaneInfo instance returns it self,
you simple connect all the calls with a dot, like:

self.mgr.AddPane(leftpanel, wx.aui.AuiPaneInfo().Bottom().CloseButton
(False).Fixed())
>

--
Fabio Spadaro
www.fabiospadaro.com

Fabio Spadaro wrote:

Tanks. It does work.
  
excuse me if I go OT but I would like to block the
SPLITTER_SASH_POS_CHANGING ' event but does not work:

def __init__(self, *args, **kwargs):
    wx.Frame.__init__(self, None, title='TITLE_FRAME',size=(700,600),pos=(0,0))
...
    self.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGING, self.onSplitterSashPosChanging)
...
def onSplitterSashPosChanging(self,evt):
     evt.Veto() #

You can disallow the changing of the sash position by calling evt.SetSashPosition(-1)

···

--
Robin Dunn
Software Craftsman