everything works fine on my app until I add a menu. Every button every field, everything ends up stacked in the top left corner. as soon as I set the menubar to the main frame and run it collapses. I have like 5 sizers that get added to a final sizer then i add the menubar to the main frame and wham. it all collapses. anyone heard of this? I'd leave the code but theres a lot to sort thru.

ok heres the code minus the methods

import wx, os



WINDOW_WIDTH = 500
WINDOW_HEIGHT = 500

ID_ABOUT=101
ID_EXIT=110




class MainFrame(wx.Frame):

    """Recall Roster"""
    def __init__(self):
        wx.Frame.__init__(self, None, title = 'Recall Roster',
                          pos = (200,75), size = (WINDOW_WIDTH, WINDOW_HEIGHT))
        
        self.background = wx.Panel(self)
        self.changeok = True

# initial import of saved information

        if os.path.exists("recall roster pkl.pkl"):
            import pickle
            pkl_file = open("recall roster pkl.pkl", "rb")
            self.member = pickle.load(pkl_file)
            pkl_file.close()
            print len(self.member), "members loaded"
        else:
            self.member = []
            print "new list created"
        self.member_names = []
        for x in self.member:
            self.member_names.append(x[0])

        filemenu= wx.Menu()
        filemenu.Append(ID_ABOUT, "&About"," Information about this program")
        filemenu.AppendSeparator()
        filemenu.Append(ID_EXIT,"E&xit"," Terminate the program")
        menuBar = wx.MenuBar()
        menuBar.Append(filemenu,"&File")
        self.SetMenuBar(menuBar)#this line messes the whole thing up#############
        wx.EVT_MENU(self, ID_ABOUT, self.OnAbout)
        wx.EVT_MENU(self, ID_EXIT, self.OnExit)


        
#buttons
        self.EditMemBtn = wx.Button(self.background, label = "Edit Member")
        self.EditMemBtn.Bind(wx.EVT_BUTTON, self.OnEditMem)

        self.DelMemBtn = wx.Button(self.background, label = "Delete")
        self.DelMemBtn.Bind(wx.EVT_BUTTON, self.OnDelete)

        self.NewMemBtn = wx.Button(self.background, label = "New Member")
        self.NewMemBtn.Bind(wx.EVT_BUTTON, self.OnNewMem)

   


        
#search tools
        self.searchbox = wx.TextCtrl(self.background, style = wx.TE_READONLY)
        self.searchbox.Bind(wx.EVT_CHAR, self.searchevent)
        self.searchbox.SetEditable(True)

        self.search_text = wx.StaticText(self.background, label = 'Search')

# statusbox and listbox
        self.status_box = wx.TextCtrl(self.background, style = wx.TE_READONLY | wx.LB_SORT)
        self.lbox = wx.ListBox(self.background, 26, wx.DefaultPosition, (170, 130), self.member_names, wx.LB_SINGLE)
        self.lbox.Bind(wx.EVT_LISTBOX, self.OnHighlight)

#   add new member button and search static text
        self.hb_9 = wx.BoxSizer() #build edit side
        self.hb_9.Add(self.EditMemBtn, proportion = 0, border = 0)
        self.hb_9.Add(self.DelMemBtn, proportion = 0, border = 0)
        self.hb_9.Add(self.NewMemBtn, proportion = 0, border = 0)
        

#   search box then search button
        self.hb_1 = wx.BoxSizer()
        self.hb_1.Add(self.search_text, proportion = 0, border = 0)
        self.hb_1.Add(self.searchbox, proportion = 1, border = 0)

#make another vertical box to add to one below      

        self.vb_2 = wx.BoxSizer(wx.VERTICAL)
        self.vb_2.Add(self.hb_1, proportion = 0, flag = wx.EXPAND, border = 0)
        self.vb_2.Add(self.status_box, proportion = 0, flag = wx.EXPAND, border = 0)
        self.vb_2.Add(self.lbox, proportion = 1, flag = wx.EXPAND, border = 0)

#new vertical box to split up search side and edit side

        self.hb_2 = wx.BoxSizer()#start of edit side inputs and label
        self.inputname = wx.TextCtrl(self.background,  style = wx.TE_READONLY)
        self.namelabel = wx.StaticText(self.background, label = 'Name               ')

        self.hb_2.Add(self.namelabel, proportion = 0, border = 0)
        self.hb_2.Add(self.inputname, proportion = 1, border = 0)
#########################
        self.hb_3 = wx.BoxSizer()#phone number
        self.inputnumber = wx.TextCtrl(self.background,  style = wx.TE_READONLY)
        self.numberlabel = wx.StaticText(self.background, label = 'Phone number ')

        self.hb_3.Add(self.numberlabel, proportion = 0, border = 0)
        self.hb_3.Add(self.inputnumber, proportion = 1, border = 0)
##############################
        self.hb_4 = wx.BoxSizer()#address
        self.inputaddress = wx.TextCtrl(self.background,  style = wx.TE_READONLY)
        self.addresslabel = wx.StaticText(self.background, label = 'Address           ')

        self.hb_4.Add(self.addresslabel, proportion = 0, border = 0)
        self.hb_4.Add(self.inputaddress, proportion = 1, border = 0)
############################        
        
        self.vb_3 = wx.BoxSizer(wx.VERTICAL)
        self.vb_3.Add(self.vb_2, proportion = 0, flag = wx.EXPAND, border = 0)#search side
        self.vb_3.Add(self.hb_2, proportion = 0, flag = wx.EXPAND, border = 0)#edit name
        self.vb_3.Add(self.hb_3, proportion = 0, flag = wx.EXPAND, border = 0)#edit number
        self.vb_3.Add(self.hb_4, proportion = 0, flag = wx.EXPAND, border = 0)#edit address
        self.vb_3.Add(self.hb_9, proportion = 1, flag = wx.EXPAND, border = 0)#edit side

        
        self.bgcolor="#c4e1ff"#light blue
        self.editcolor="#e0e0e0"#light grey

        self.background.SetSizer(self.vb_3)
        self.background.SetBackgroundColour(self.bgcolor)
        self.status_box.SetBackgroundColour(self.bgcolor)
        self.lbox.SetBackgroundColour(self.editcolor)
        self.searchbox.SetBackgroundColour(self.editcolor)
        self.EditStatus(editable=False)
        self.Show()

Your problem isn't menubar, it is that, you have added bound self to events that doesnt exist. What I have done is, I have added two of them and commented out all the rest. So Go and define those events and then rearrange the stuffs in sizers in smart way!

import wx, os



WINDOW_WIDTH = 500
WINDOW_HEIGHT = 500

ID_ABOUT=101
ID_EXIT=110




class MainFrame(wx.Frame):
    """Recall Roster"""
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title, pos = (200,75), size = (WINDOW_WIDTH, WINDOW_HEIGHT))
        
        self.background = wx.Panel(self)
        self.changeok = True

# initial import of saved information

        if os.path.exists("recall roster pkl.pkl"):
            import pickle
            pkl_file = open("recall roster pkl.pkl", "rb")
            self.member = pickle.load(pkl_file)
            pkl_file.close()
            print len(self.member), "members loaded"
        else:
            self.member = []
            print "new list created"
        self.member_names = []
        for x in self.member:
            self.member_names.append(x[0])

        filemenu= wx.Menu()
        filemenu.Append(ID_ABOUT, "&About"," Information about this program")
        filemenu.AppendSeparator()
        filemenu.Append(ID_EXIT,"E&xit"," Terminate the program")
        menuBar = wx.MenuBar()
        menuBar.Append(filemenu,"&File")
        self.SetMenuBar(menuBar)
        
        wx.EVT_MENU(self, ID_ABOUT, self.OnAbout)
        wx.EVT_MENU(self, ID_EXIT, self.OnExit)


        
#buttons
        self.EditMemBtn = wx.Button(self.background, label = "Edit Member")
        #self.EditMemBtn.Bind(wx.EVT_BUTTON, self.OnEditMem)

        self.DelMemBtn = wx.Button(self.background, label = "Delete")
        #self.DelMemBtn.Bind(wx.EVT_BUTTON, self.OnDelete)

        self.NewMemBtn = wx.Button(self.background, label = "New Member")
        #self.NewMemBtn.Bind(wx.EVT_BUTTON, self.OnNewMem)

   


        
#search tools
        self.searchbox = wx.TextCtrl(self.background, style = wx.TE_READONLY)
        #self.searchbox.Bind(wx.EVT_CHAR, self.searchevent)
        self.searchbox.SetEditable(True)

        self.search_text = wx.StaticText(self.background, label = 'Search')

# statusbox and listbox
        self.status_box = wx.TextCtrl(self.background, style = wx.TE_READONLY | wx.LB_SORT)
        self.lbox = wx.ListBox(self.background, 26, wx.DefaultPosition, (170, 130), self.member_names, wx.LB_SINGLE)
        #self.lbox.Bind(wx.EVT_LISTBOX, self.OnHighlight)

#   add new member button and search static text
        self.hb_9 = wx.BoxSizer() #build edit side
        self.hb_9.Add(self.EditMemBtn, proportion = 0, border = 0)
        self.hb_9.Add(self.DelMemBtn, proportion = 0, border = 0)
        self.hb_9.Add(self.NewMemBtn, proportion = 0, border = 0)
        

#   search box then search button
        self.hb_1 = wx.BoxSizer()
        self.hb_1.Add(self.search_text, proportion = 0, border = 0)
        self.hb_1.Add(self.searchbox, proportion = 1, border = 0)

#make another vertical box to add to one below      

        self.vb_2 = wx.BoxSizer(wx.VERTICAL)
        self.vb_2.Add(self.hb_1, proportion = 0, flag = wx.EXPAND, border = 0)
        self.vb_2.Add(self.status_box, proportion = 0, flag = wx.EXPAND, border = 0)
        self.vb_2.Add(self.lbox, proportion = 1, flag = wx.EXPAND, border = 0)

#new vertical box to split up search side and edit side

        self.hb_2 = wx.BoxSizer()#start of edit side inputs and label
        self.inputname = wx.TextCtrl(self.background,  style = wx.TE_READONLY)
        self.namelabel = wx.StaticText(self.background, label = 'Name               ')

        self.hb_2.Add(self.namelabel, proportion = 0, border = 0)
        self.hb_2.Add(self.inputname, proportion = 1, border = 0)
#########################
        self.hb_3 = wx.BoxSizer()#phone number
        self.inputnumber = wx.TextCtrl(self.background,  style = wx.TE_READONLY)
        self.numberlabel = wx.StaticText(self.background, label = 'Phone number ')

        self.hb_3.Add(self.numberlabel, proportion = 0, border = 0)
        self.hb_3.Add(self.inputnumber, proportion = 1, border = 0)
##############################
        self.hb_4 = wx.BoxSizer()#address
        self.inputaddress = wx.TextCtrl(self.background,  style = wx.TE_READONLY)
        self.addresslabel = wx.StaticText(self.background, label = 'Address           ')

        self.hb_4.Add(self.addresslabel, proportion = 0, border = 0)
        self.hb_4.Add(self.inputaddress, proportion = 1, border = 0)
############################        
        
        self.vb_3 = wx.BoxSizer(wx.VERTICAL)
        self.vb_3.Add(self.vb_2, proportion = 0, flag = wx.EXPAND, border = 0)#search side
        self.vb_3.Add(self.hb_2, proportion = 0, flag = wx.EXPAND, border = 0)#edit name
        self.vb_3.Add(self.hb_3, proportion = 0, flag = wx.EXPAND, border = 0)#edit number
        self.vb_3.Add(self.hb_4, proportion = 0, flag = wx.EXPAND, border = 0)#edit address
        self.vb_3.Add(self.hb_9, proportion = 1, flag = wx.EXPAND, border = 0)#edit side

        
        self.bgcolor="#c4e1ff"#light blue
        self.editcolor="#e0e0e0"#light grey

        self.background.SetSizer(self.vb_3)
        self.background.SetBackgroundColour(self.bgcolor)
        self.status_box.SetBackgroundColour(self.bgcolor)
        self.lbox.SetBackgroundColour(self.editcolor)
        self.searchbox.SetBackgroundColour(self.editcolor)
        #self.EditStatus(editable=False)
        self.Show(True)
        
        #events handling
    def OnAbout(self, event):
        dia = wx.MessageBox("Programmed by Me!", "About my Software")
        ret = dia.ShowModal()
        if ret == wx.ID_OK:
            dia.Destroy()
    
    def OnExit(self, event):
        self.Close()
        
app = wx.App(False)
MainFrame(None, -1, "Worked Successful!")
app.MainLoop()

No I have all the events defined. I didnt post them cuz it would triple the length of the post. The app works great until I try add the menubar.

Have you tested my above code? It works for me with menu bar but the only weird thing is, the things are not well arranged in sizer. If above code doesn't work for you then something is wrong with your installation may be!

BTW how do you run it? Commandline or IDLE/IDE?

I just f5 in idle.... that worked for you?? Its not all stacked on top of each other?

It work for me in Idle
Just check for installation! What windows and version/linux do you use??

the vista.. . running python 2.5, wx 2.8 unicode...

I have the same and it works for me. Try re-installing wxpython but raise it to admin level by right click, run as admin and feeback

I reinstalled wx same problem. Theres no option in vista to run .py files as admins. I tried to set the python.exe to run as an administrator but it was greyed out. Same problem exists.

I mean while installing the wxpython is when you right click wxpython and run the setup as admin. try to get the latest.

Did what traceback error does it give anyway??

Ok, I reinstalled wx as an admin, then re-ran the app. It looks the same as it did. But it never returns an error, just piles everything on top of each other.... and then as I was going to take a screen shot to show to you I clicked the maximize button, the app maximized and looked perfect. Then I clicked restore down button and it still looked fine!!! what the hell!! any ideas??

Sorry, I forgot (I actually didn't knew it was not there) to attach your panel to whole layout
Here is rectified code
Enjoy!

import wx, os



WINDOW_WIDTH = 500
WINDOW_HEIGHT = 500

ID_ABOUT=101
ID_EXIT=110




class MainFrame(wx.Frame):
    """Recall Roster"""
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title, pos = (200,75), size = (WINDOW_WIDTH, WINDOW_HEIGHT))
        
        self.background = wx.Panel(self)
        self.changeok = True

# initial import of saved information

        if os.path.exists("recall roster pkl.pkl"):
            import pickle
            pkl_file = open("recall roster pkl.pkl", "rb")
            self.member = pickle.load(pkl_file)
            pkl_file.close()
            print len(self.member), "members loaded"
        else:
            self.member = []
            print "new list created"
        self.member_names = []
        for x in self.member:
            self.member_names.append(x[0])

        filemenu= wx.Menu()
        filemenu.Append(ID_ABOUT, "&About"," Information about this program")
        filemenu.AppendSeparator()
        filemenu.Append(ID_EXIT,"E&xit"," Terminate the program")
        menuBar = wx.MenuBar()
        menuBar.Append(filemenu,"&File")
        self.SetMenuBar(menuBar)
        
        wx.EVT_MENU(self, ID_ABOUT, self.OnAbout)
        wx.EVT_MENU(self, ID_EXIT, self.OnExit)


        
#buttons
        self.EditMemBtn = wx.Button(self.background, label = "Edit Member")
        #self.EditMemBtn.Bind(wx.EVT_BUTTON, self.OnEditMem)

        self.DelMemBtn = wx.Button(self.background, label = "Delete")
        #self.DelMemBtn.Bind(wx.EVT_BUTTON, self.OnDelete)

        self.NewMemBtn = wx.Button(self.background, label = "New Member")
        #self.NewMemBtn.Bind(wx.EVT_BUTTON, self.OnNewMem)

   


        
#search tools
        self.searchbox = wx.TextCtrl(self.background, style = wx.TE_READONLY)
        #self.searchbox.Bind(wx.EVT_CHAR, self.searchevent)
        self.searchbox.SetEditable(True)

        self.search_text = wx.StaticText(self.background, label = 'Search')

# statusbox and listbox
        self.status_box = wx.TextCtrl(self.background, style = wx.TE_READONLY | wx.LB_SORT)
        self.lbox = wx.ListBox(self.background, 26, wx.DefaultPosition, (170, 130), self.member_names, wx.LB_SINGLE)
        #self.lbox.Bind(wx.EVT_LISTBOX, self.OnHighlight)

#   add new member button and search static text
        self.hb_9 = wx.BoxSizer() #build edit side
        self.hb_9.Add(self.EditMemBtn, proportion = 0, border = 0)
        self.hb_9.Add(self.DelMemBtn, proportion = 0, border = 0)
        self.hb_9.Add(self.NewMemBtn, proportion = 0, border = 0)
        

#   search box then search button
        self.hb_1 = wx.BoxSizer()
        self.hb_1.Add(self.search_text, proportion = 0, border = 0)
        self.hb_1.Add(self.searchbox, proportion = 1, border = 0)

#make another vertical box to add to one below      

        self.vb_2 = wx.BoxSizer(wx.VERTICAL)
        self.vb_2.Add(self.hb_1, proportion = 0, flag = wx.EXPAND, border = 0)
        self.vb_2.Add(self.status_box, proportion = 0, flag = wx.EXPAND, border = 0)
        self.vb_2.Add(self.lbox, proportion = 1, flag = wx.EXPAND, border = 0)

#new vertical box to split up search side and edit side

        self.hb_2 = wx.BoxSizer()#start of edit side inputs and label
        self.inputname = wx.TextCtrl(self.background,  style = wx.TE_READONLY)
        self.namelabel = wx.StaticText(self.background, label = 'Name               ')

        self.hb_2.Add(self.namelabel, proportion = 0, border = 0)
        self.hb_2.Add(self.inputname, proportion = 1, border = 0)
#########################
        self.hb_3 = wx.BoxSizer()#phone number
        self.inputnumber = wx.TextCtrl(self.background,  style = wx.TE_READONLY)
        self.numberlabel = wx.StaticText(self.background, label = 'Phone number ')

        self.hb_3.Add(self.numberlabel, proportion = 0, border = 0)
        self.hb_3.Add(self.inputnumber, proportion = 1, border = 0)
##############################
        self.hb_4 = wx.BoxSizer()#address
        self.inputaddress = wx.TextCtrl(self.background,  style = wx.TE_READONLY)
        self.addresslabel = wx.StaticText(self.background, label = 'Address           ')

        self.hb_4.Add(self.addresslabel, proportion = 0, border = 0)
        self.hb_4.Add(self.inputaddress, proportion = 1, border = 0)
############################        
        
        self.vb_3 = wx.BoxSizer(wx.VERTICAL)
        self.vb_3.Add(self.vb_2, proportion = 0, flag = wx.EXPAND, border = 0)#search side
        self.vb_3.Add(self.hb_2, proportion = 0, flag = wx.EXPAND, border = 0)#edit name
        self.vb_3.Add(self.hb_3, proportion = 0, flag = wx.EXPAND, border = 0)#edit number
        self.vb_3.Add(self.hb_4, proportion = 0, flag = wx.EXPAND, border = 0)#edit address
        self.vb_3.Add(self.hb_9, proportion = 1, flag = wx.EXPAND, border = 0)#edit side

        
        self.bgcolor="#c4e1ff"#light blue
        self.editcolor="#e0e0e0"#light grey

        self.background.SetSizer(self.vb_3)
        #Forgotten to add Panel to a layout
        #------------------------------
        self.background.Layout()
        #------------------------------
        self.background.SetBackgroundColour(self.bgcolor)
        self.status_box.SetBackgroundColour(self.bgcolor)
        self.lbox.SetBackgroundColour(self.editcolor)
        self.searchbox.SetBackgroundColour(self.editcolor)
        #self.EditStatus(editable=False)
        self.Show(True)
        
        #events handling
    def OnAbout(self, event):
        dia = wx.MessageBox("Programmed by Me!", "About my Software")
        ret = dia.ShowModal()
        if ret == wx.ID_OK:
            dia.Destroy()
    
    def OnExit(self, event):
        self.Close()
        
app = wx.App(False)
MainFrame(None, -1, "Worked Successful!")
app.MainLoop()
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.