tweak 0 Newbie Poster

Well I'm new to wxpython and in trying to learn I started making a small Phone Book program but now I'm stuck need some help on a few things. First thing is when I click on my New Contact in my menu I want a new frame to appear with the appropriate text box for a name and number entry and same with the other menu items but I'm unsure how to go about doing this I tried searching for similar Phone Book programs written in wxpython for a reference but couldn't find anything of use. Second thing is how would I bind the menu items to the StaticText and add everything to anydbm so it shows up? and I know I'm probably doing a lot of things wrong but this is my first attempt at making something in wxpython and using a DB.

import wx
import anydbm

class Phonebook(wx.Frame):
    
    def __init__(self, parent, id):
        wx.Frame.__init__(self, parent, id, 'Phonebook v1.0', size=(500,600))
        
        db = anydbm.open("phonebook.db", "c")
        
        menubar = wx.MenuBar()
        
        first = wx.Menu()
        
        first.Append(101, "New Contact...","Add a New Contact")
        self.Bind(wx.EVT_MENU, self.OnAdd, id=101)
        
        first.Append(102, "New Group...", "Creates New Group")
        self.Bind(wx.EVT_MENU, self.OnGroup, id=102)
        
        first.Append(103, "Delete Contact...", "Delete a Contact")
        self.Bind(wx.EVT_MENU, self.OnDel, id=103)
        
        first.Append(104, "Delete Group...", "Delete a Group")
        self.Bind(wx.EVT_MENU, self.OnDelGroup, id=104)
        
        first.AppendSeparator()
        
        first.Append(105, "Exit", "Exit Phonebook")
        self.Bind(wx.EVT_MENU, self.OnExit, id=105)
        
        menubar.Append(first, "File")
        
        #End File Menu
        
        second = wx.Menu()
        
        second.Append(106, "Search...", "Search for Contact")
        self.Bind(wx.EVT_MENU, self.OnDelGroup, id=106)
        
        second.AppendSeparator()
        
        second.Append(107, "Show All", "View All Contacts")
        self.Bind(wx.EVT_MENU, self.OnDelGroup, id=107)
        
        second.AppendSeparator()
        
        second.Append(108, "Import", "Import an Address Book")
        self.Bind(wx.EVT_MENU, self.OnDelGroup, id=108)
    
        menubar.Append(second, "Edit")
        
        #End Edit Menu
        
        third = wx.Menu()
        
        third.Append(109, "Contact", "Contact Us")
        self.Bind(wx.EVT_MENU, self.OnDelGroup, id=109)
        
        third.AppendSeparator()
        
        third.Append(110, "About", "About Phonebook")
        self.Bind(wx.EVT_MENU, self.OnAbout, id=110)
        
        menubar.Append(third, "Help")
        
        self.SetMenuBar(menubar)
        
        #End Help Menu
        
        treebook = wx.Treebook(self, -1, size=(105,525))
        
        textwin = wx.StaticText(self, -1, "", (105,0), size=(387,525)).SetBackgroundColour("White")
        
        status = self.CreateStatusBar()
        
    def OnAdd(db):
        name = raw_input('Contact Name:')
        number = raw_input('Phone Number:')
        db[name]=phone
        
    def OnGroup(db):
        group = raw_input('Enter Group Name:')
        
    def OnDel(db):
        delete = raw_input('Enter Contact Name:')
        del db[name]
        
    def OnDelGroup(db):
        delete = raw_input('Enter Group To Delete:')
        
    def OnExit(self, event):
        self.Close()
        
        #End
        
    def OnAbout(self, event):
        wx.MessageBox("Phonebook", "About", wx.OK)
        
        
        
        
        
        
if __name__=='__main__':
    app = wx.PySimpleApp()
    frame = Phonebook(parent=None, id=-1)
    frame.Show()
    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.