Trouble when Creating a Panel

By the way, I'm not really sure what layout you are going for, but
since you want multiple panels shown...have you tried using any of the
"book" controls (wxNotebook, etc.) found in the Demo? That's what
they are for, and might simplify things for you.

···

On Tue, May 20, 2008 at 7:33 PM, David Anderson <zerty.david@gmail.com> wrote:

Hi, I have a Class Named MainnApp, Whcih is derived from wx.Frame, There I
call any of my subclasses that are derived from wx.panels, The thing is, if
I call like this:
self.Panel = DerivedPanel(self, -1)

It shows the derived one fine, But I'm trying to show these panels through
the menu, So On the init of my MainApp class I create a self.panel =
Frame(self,-1)

and on the Menu's event handler I do like this
self.Panel = DerivedPanel(self, -1)
The thing is... Its putting everything of the menu on the top left corner
above everything, Doesn'1t create as when I call it on the init method
What am I doing wrong?
Hope you understand my problem
=)

It’s not multiple panels, Its just changing panels on the same window, changing the screen Got it?
And

David Anderson wrote:

It shows the derived one fine, But I’m trying to show these panels

through the menu, So On the init of my MainApp class I create a

self.panel = Frame(self,-1)

this would create a Frame, not a Panel…

I Mis typed
Take a look at the code:
class MainWindow(wx.Frame):
def init(self, parent, id, title = “Finarta Order Search”):
wx.Frame.init(self, parent, id, title, size = (1024,740),style = wx.CLOSE_BOX |

                       wx.CAPTION |wx.SYSTEM_MENU| wx.MINIMIZE_BOX|wx.CLOSE_BOX)
    self.buildMenu()
    self.Centre()
    self.Fit()
    self.SetSize((1024,740))
    self.Show(True)

def buildMenu(self):
            menubar = wx.MenuBar()
            home = wx.Menu()
            exit = wx.MenuItem(home, wx.ID_ANY, 'Exit')
            home.AppendItem(exit)
            menubar.Append(home, '&Home')

            order = wx.Menu()
            add = wx.MenuItem(order, wx.ID_ANY, "Add")
            view = wx.MenuItem(order, wx.ID_ANY, "View")
            edit = wx.MenuItem(order, wx.ID_ANY, "Edit")

            search = wx.MenuItem(order, wx.ID_ANY, "Search")
            order.AppendItem(add)
            order.AppendItem(view)
            order.AppendItem(edit)
            order.AppendItem(search)

            menubar.Append(order, '&Order')
            self.Bind(wx.EVT_MENU, self.OnAddOrder, add)
            self.Bind(wx.EVT_MENU, self.OnViewOrder, view)
            self.Bind(wx.EVT_MENU, self.OnEditOrder, edit)

            self.Bind(wx.EVT_MENU, self.OnSearchOrder, search)

def OnAddOrder(self, evt):
self.DestroyChildren()
apanel = AddOrder(self,-1)
self.Centre()
self.Fit()

    self.SetSize((1024,740))
    self.Show(True)

def OnEditOrder(self, evt):
    self.DestroyChildren()
    apanel = EditOrder(self, -1)
    self.Centre()
    self.Fit()

    self.SetSize((1024,740))
    self.Show(True)

def OnViewOrder(self, evt):
    self.DestroyChildren()
    apanel = ViewOrder(self, -1)
    self.Centre()
    self.Fit()

    self.SetSize((1024,740))
    self.Show(True)

def OnSearchOrder(self, evt):
    self.DestroyChildren()
    apanel = OrderSearch(self, -1)
    self.Centre()
    self.Fit()

    self.SetSize((1024,740))
    self.Show(True)

That’s it =)

···

On Tue, May 20, 2008 at 10:02 PM, C M cmpython@gmail.com wrote:

On Tue, May 20, 2008 at 7:33 PM, David Anderson zerty.david@gmail.com wrote:

Hi, I have a Class Named MainnApp, Whcih is derived from wx.Frame, There I

call any of my subclasses that are derived from wx.panels, The thing is, if

I call like this:

self.Panel = DerivedPanel(self, -1)

It shows the derived one fine, But I’m trying to show these panels through

the menu, So On the init of my MainApp class I create a self.panel =

Frame(self,-1)

and on the Menu’s event handler I do like this

self.Panel = DerivedPanel(self, -1)

The thing is… Its putting everything of the menu on the top left corner

above everything, Doesn’1t create as when I call it on the init method

What am I doing wrong?

Hope you understand my problem

=)

By the way, I’m not really sure what layout you are going for, but

since you want multiple panels shown…have you tried using any of the

“book” controls (wxNotebook, etc.) found in the Demo? That’s what

they are for, and might simplify things for you.


wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

There’s some code missing but I think you can understand it =)

···

On Tue, May 20, 2008 at 10:11 PM, David Anderson zerty.david@gmail.com wrote:

It’s not multiple panels, Its just changing panels on the same window, changing the screen Got it?

And

David Anderson wrote:

It shows the derived one fine, But I’m trying to show these panels

through the menu, So On the init of my MainApp class I create a

self.panel = Frame(self,-1)

this would create a Frame, not a Panel…

I Mis typed
Take a look at the code:
class MainWindow(wx.Frame):
def init(self, parent, id, title = “Finarta Order Search”):
wx.Frame.init(self, parent, id, title, size = (1024,740),style = wx.CLOSE_BOX |

                       wx.CAPTION |wx.SYSTEM_MENU| wx.MINIMIZE_BOX|wx.CLOSE_BOX)
    self.buildMenu()
    self.Centre()
    self.Fit()
    self.SetSize((1024,740))
    self.Show(True)


def buildMenu(self):
            menubar = wx.MenuBar()
            home = wx.Menu()
            exit = wx.MenuItem(home, wx.ID_ANY, 'Exit')
            home.AppendItem(exit)
            menubar.Append(home, '&Home')


            order = wx.Menu()
            add = wx.MenuItem(order, wx.ID_ANY, "Add")
            view = wx.MenuItem(order, wx.ID_ANY, "View")
            edit = wx.MenuItem(order, wx.ID_ANY, "Edit")


            search = wx.MenuItem(order, wx.ID_ANY, "Search")
            order.AppendItem(add)
            order.AppendItem(view)
            order.AppendItem(edit)
            order.AppendItem(search)


            menubar.Append(order, '&Order')
            self.Bind(wx.EVT_MENU, self.OnAddOrder, add)
            self.Bind(wx.EVT_MENU, self.OnViewOrder, view)
            self.Bind(wx.EVT_MENU, self.OnEditOrder, edit)


            self.Bind(wx.EVT_MENU, self.OnSearchOrder, search)

def OnAddOrder(self, evt):
self.DestroyChildren()
apanel = AddOrder(self,-1)
self.Centre()
self.Fit()

    self.SetSize((1024,740))
    self.Show(True)

def OnEditOrder(self, evt):
    self.DestroyChildren()
    apanel = EditOrder(self, -1)
    self.Centre()
    self.Fit()


    self.SetSize((1024,740))
    self.Show(True)

def OnViewOrder(self, evt):
    self.DestroyChildren()
    apanel = ViewOrder(self, -1)
    self.Centre()
    self.Fit()


    self.SetSize((1024,740))
    self.Show(True)

def OnSearchOrder(self, evt):
    self.DestroyChildren()
    apanel = OrderSearch(self, -1)
    self.Centre()
    self.Fit()


    self.SetSize((1024,740))
    self.Show(True)

That’s it =)

On Tue, May 20, 2008 at 10:02 PM, C M cmpython@gmail.com wrote:

On Tue, May 20, 2008 at 7:33 PM, David Anderson zerty.david@gmail.com wrote:

Hi, I have a Class Named MainnApp, Whcih is derived from wx.Frame, There I

call any of my subclasses that are derived from wx.panels, The thing is, if

I call like this:

self.Panel = DerivedPanel(self, -1)

It shows the derived one fine, But I’m trying to show these panels through

the menu, So On the init of my MainApp class I create a self.panel =

Frame(self,-1)

and on the Menu’s event handler I do like this

self.Panel = DerivedPanel(self, -1)

The thing is… Its putting everything of the menu on the top left corner

above everything, Doesn’1t create as when I call it on the init method

What am I doing wrong?

Hope you understand my problem

=)

By the way, I’m not really sure what layout you are going for, but

since you want multiple panels shown…have you tried using any of the

“book” controls (wxNotebook, etc.) found in the Demo? That’s what

they are for, and might simplify things for you.


wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Yes

···

On Wed, May 21, 2008 at 12:19 AM, C M cmpython@gmail.com wrote:

On Tue, May 20, 2008 at 9:11 PM, David Anderson zerty.david@gmail.com wrote:

It’s not multiple panels, Its just changing panels on the same window,

changing the screen Got it?

I’m sorry I wasn’t clear. Is it that there is one panel always shown,

but that which panel that is will depend on what the user selects in

the menu?


wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users