pannels placement

Hi,

In the code below, I have an horizontal box with two pannels ... can someone
tell me why the pannels are one above the other (i.e, the green pannel
hides the blue)?

Thanks,

    #!/bin/env python
# -*- coding: iso-8859-15 -*-

···

#----------------------------------------------------------------------------
# Name: SCIDE.py
# Author: XXXX
# Created: XX/XX/XX
# Copyright:
#----------------------------------------------------------------------------

import wx

#from SCIDE_wdr import *
ID_MENU = 10002

def MyMenuBarFunc():
    item0 = wx.MenuBar()
    
    item1 = wx.Menu()
    item1.Append( wx.ID_ABOUT, "About", "" )
    item1.Append( wx.ID_EXIT, "Quit", "" )
    item0.Append( item1, "File" )
    
    return item0

# Toolbar functions

def MyToolBarFunc( parent ):
    parent.SetMargins( [2,2] )
    
    parent.Realize()

# WDR: classes
ID_PANEL_SHELL = 1000
ID_PANEL_CODE = 1001
class MySCIDEFrame(wx.Frame):
    def __init__(self, parent, id, title,
        pos = wx.DefaultPosition, size = wx.DefaultSize,
        style = wx.DEFAULT_FRAME_STYLE ):
        wx.Frame.__init__(self, parent, id, title, pos, size, style)
        
        self.CreateMyMenuBar()
        
        self.CreateMyToolBar()
        
        self.CreateStatusBar(1)
        self.SetStatusText("Welcome!")
        
        # insert main window here
        #MySCIDEDialogFunc(self, False, False)
        item0 = wx.BoxSizer( wx.HORIZONTAL )
        item1 = wx.Panel( self, ID_PANEL_SHELL, wx.DefaultPosition, [200,160],
0 )
        item1.SetBackgroundColour( wx.BLUE )
        item0.Add( item1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
    
        item2 = wx.Panel( self, ID_PANEL_CODE, wx.DefaultPosition, [200,160],
0 )
        item2.SetBackgroundColour( wx.GREEN )
        item0.Add( item2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
        self.SetSizer( item0 )
        item0.SetSizeHints( self )
        # WDR: handler declarations for MySCIDEFrame
        wx.EVT_MENU(self, wx.ID_ABOUT, self.OnAbout)
        wx.EVT_MENU(self, wx.ID_EXIT, self.OnQuit)
        wx.EVT_CLOSE(self, self.OnCloseWindow)
        wx.EVT_SIZE(self, self.OnPanel1Size)

    # WDR: methods for MySCIDEFrame
    
    def CreateMyMenuBar(self):
        self.SetMenuBar( MyMenuBarFunc() )
    
    def CreateMyToolBar(self):
        tb = self.CreateToolBar(wx.TB_HORIZONTAL|wx.NO_BORDER)
        MyToolBarFunc( tb )
    
    # WDR: handler implementations for MySCIDEFrame
    
    def OnAbout(self, event):
        dialog = wx.MessageDialog(self, "Welcome to SuperApp 1.0\n(C)opyright
Joe Hacker",
            "About SuperApp", wx.OK|wx.ICON_INFORMATION )
        dialog.CentreOnParent()
        dialog.ShowModal()
        dialog.Destroy()
    
    def OnQuit(self, event):
        self.Close(True)
    
    def OnCloseWindow(self, event):
        self.Destroy()
        
    def OnPanel1Size(self, event):
        print 'CALLED'
        l_frame_size = event.GetSize()
        l_fs_1 = (l_frame_size[0] / 2, l_frame_size[1] / 2,)
        l_fs_2 = (l_frame_size[0] / 2, l_frame_size[1] / 2,)
        
        # Resize the top level panel
        self.GetCodePanel().SetSize(l_fs_1)
        self.GetShellPanel().SetSize(l_fs_2)

    def GetCodePanel(self):
        return self.FindWindowById( ID_PANEL_CODE )
    def GetShellPanel(self):
        return self.FindWindowById( ID_PANEL_SHELL)

#----------------------------------------------------------------------------

class MySCIDEApp(wx.App):
    
    def OnInit(self):
        wx.InitAllImageHandlers()
        frame = MySCIDEFrame( None, -1, "SuperApp", [20,20], [500,340] )
        frame.Show(True)
        
        return True

#----------------------------------------------------------------------------

app = MySCIDEApp(False)
app.MainLoop()

--
_________________________
Philippe C. Martin
www.snakecard.com
_________________________

Well, I did not know about Skip ... but even if I comment the binding, I have
the same problem.

Philippe

···

On Thursday 14 December 2006 14:38, Chris Mellon wrote:

On 12/14/06, Philippe C. Martin <pmartin@snakecard.com> wrote:
> Hi,
>
> In the code below, I have an horizontal box with two pannels ... can
> someone tell me why the pannels are one above the other (i.e, the green
> pannel hides the blue)?

<code snipped>

Because by binding to the size event and not calling event.Skip() you
are keeping the sizer from doing it's job.

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

--
_________________________
Philippe C. Martin
www.snakecard.com
_________________________

> > Hi,
> >
> > In the code below, I have an horizontal box with two pannels ... can
> > someone tell me why the pannels are one above the other (i.e, the green
> > pannel hides the blue)?
>
> <code snipped>
>
> Because by binding to the size event and not calling event.Skip() you
> are keeping the sizer from doing it's job.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Well, I did not know about Skip ... but even if I comment the binding, I have
the same problem.

Then it's not the same problem. Removing the size event binding causes
the panels to display exactly as your sizer code would indicate.

···

On 12/14/06, Philippe C. Martin <pmartin@snakecard.com> wrote:

On Thursday 14 December 2006 14:38, Chris Mellon wrote:
> On 12/14/06, Philippe C. Martin <pmartin@snakecard.com> wrote:

Philippe

--
_________________________
Philippe C. Martin
www.snakecard.com
_________________________

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Hi,

In the code below, I have an horizontal box with two pannels ... can someone
tell me why the pannels are one above the other (i.e, the green pannel
hides the blue)?

[snip]

        #MySCIDEDialogFunc(self, False, False)
        item0 = wx.BoxSizer( wx.HORIZONTAL )
        item1 = wx.Panel( self, ID_PANEL_SHELL, wx.DefaultPosition, [200,160],
0 )
        item1.SetBackgroundColour( wx.BLUE )
        item0.Add( item1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
    
        item2 = wx.Panel( self, ID_PANEL_CODE, wx.DefaultPosition, [200,160],
0 )
        item2.SetBackgroundColour( wx.GREEN )
        item0.Add( item2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
        self.SetSizer( item0 )

[snip]

    def OnPanel1Size(self, event):
        print 'CALLED'
        l_frame_size = event.GetSize()
        l_fs_1 = (l_frame_size[0] / 2, l_frame_size[1] / 2,)
        l_fs_2 = (l_frame_size[0] / 2, l_frame_size[1] / 2,)
        
        # Resize the top level panel
        self.GetCodePanel().SetSize(l_fs_1)
        self.GetShellPanel().SetSize(l_fs_2)

You are using both sizers and manual sizing. Stop manually sizing and
your panels will handle themselves.

- Josiah

···

"Philippe C. Martin" <pmartin@snakecard.com> wrote:

Well no they don't ... BTW I've just installed 2.8.1 ... could I have some
version conflicts ?

···

On Thursday 14 December 2006 14:55, Josiah Carlson wrote:

"Philippe C. Martin" <pmartin@snakecard.com> wrote:
> Hi,
>
> In the code below, I have an horizontal box with two pannels ... can
> someone tell me why the pannels are one above the other (i.e, the green
> pannel hides the blue)?

[snip]

> #MySCIDEDialogFunc(self, False, False)
> item0 = wx.BoxSizer( wx.HORIZONTAL )
> item1 = wx.Panel( self, ID_PANEL_SHELL, wx.DefaultPosition,
> [200,160], 0 )
> item1.SetBackgroundColour( wx.BLUE )
> item0.Add( item1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
>
> item2 = wx.Panel( self, ID_PANEL_CODE, wx.DefaultPosition,
> [200,160], 0 )
> item2.SetBackgroundColour( wx.GREEN )
> item0.Add( item2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
> self.SetSizer( item0 )

[snip]

> def OnPanel1Size(self, event):
> print 'CALLED'
> l_frame_size = event.GetSize()
> l_fs_1 = (l_frame_size[0] / 2, l_frame_size[1] / 2,)
> l_fs_2 = (l_frame_size[0] / 2, l_frame_size[1] / 2,)
>
>
> # Resize the top level panel
> self.GetCodePanel().SetSize(l_fs_1)
> self.GetShellPanel().SetSize(l_fs_2)

You are using both sizers and manual sizing. Stop manually sizing and
your panels will handle themselves.

- Josiah

--
_________________________
Philippe C. Martin
www.snakecard.com
_________________________

> > Hi,
> >
> > In the code below, I have an horizontal box with two pannels ... can
> > someone tell me why the pannels are one above the other (i.e, the green
> > pannel hides the blue)?
>
> [snip]
>
> > #MySCIDEDialogFunc(self, False, False)
> > item0 = wx.BoxSizer( wx.HORIZONTAL )
> > item1 = wx.Panel( self, ID_PANEL_SHELL, wx.DefaultPosition,
> > [200,160], 0 )
> > item1.SetBackgroundColour( wx.BLUE )
> > item0.Add( item1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
> >
> > item2 = wx.Panel( self, ID_PANEL_CODE, wx.DefaultPosition,
> > [200,160], 0 )
> > item2.SetBackgroundColour( wx.GREEN )
> > item0.Add( item2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5 )
> > self.SetSizer( item0 )
>
> [snip]
>
> > def OnPanel1Size(self, event):
> > print 'CALLED'
> > l_frame_size = event.GetSize()
> > l_fs_1 = (l_frame_size[0] / 2, l_frame_size[1] / 2,)
> > l_fs_2 = (l_frame_size[0] / 2, l_frame_size[1] / 2,)
> >
> > # Resize the top level panel
> > self.GetCodePanel().SetSize(l_fs_1)
> > self.GetShellPanel().SetSize(l_fs_2)
>
> You are using both sizers and manual sizing. Stop manually sizing and
> your panels will handle themselves.
>
> - Josiah

Well no they don't ... BTW I've just installed 2.8.1 ... could I have some
version conflicts ?

Extremely doubtful. The code you posted, with the only modification
being the removal of the OnSize binding, works fine. I don't believe
that the code as posted doesn't work, I suspect you've changed
something else.

···

On 12/14/06, Philippe C. Martin <pmartin@snakecard.com> wrote:

On Thursday 14 December 2006 14:55, Josiah Carlson wrote:
> "Philippe C. Martin" <pmartin@snakecard.com> wrote:

--
_________________________
Philippe C. Martin
www.snakecard.com
_________________________

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

This is what I did to "fix" the problem:

1) mv wx-2.8-gtk2-ansi .wx-2.8-gtk2-ansi
2) I modified wx.pht to point to wx-2.6-gtk2-unicode

... and my pannels behave as expected ... any clue ?

Thanks,

Philippe

···

--
_________________________
Philippe C. Martin
www.snakecard.com
_________________________

Well I'll do some more searching before spamming here.

Thanks,

Philippe

···

On Thursday 14 December 2006 15:02, Philippe C. Martin wrote:

This is what I did to "fix" the problem:

1) mv wx-2.8-gtk2-ansi .wx-2.8-gtk2-ansi
2) I modified wx.pht to point to wx-2.6-gtk2-unicode

... and my pannels behave as expected ... any clue ?

Thanks,

Philippe

--
_________________________
Philippe C. Martin
www.snakecard.com
_________________________

Nice !

···

On Thursday 14 December 2006 19:58, Robin Dunn wrote:

 import wxversion; wxversion\.select\(&#39;2\.6&#39;\)

--
_________________________
Philippe C. Martin
www.snakecard.com
_________________________