import wx
import wx.grid as  gridlib

########################################################################
class NewFrame(wx.Frame):
    """"""
    #----------------------------------------------------------------------
    def __init__(self):
        """Constructor"""
        wx.Frame.__init__(self, None, wx.ID_ANY, "Simple Grid")
        # Add a panel so it looks the correct on all platforms
        panel = wx.Panel(self, wx.ID_ANY)
        grid = EditorsAndRenderersGrid(panel)
        
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(grid, 1, wx.EXPAND)
        panel.SetSizer(sizer)
        
########################################################################
class EditorsAndRenderersGrid(gridlib.Grid):
    #----------------------------------------------------------------------
    def __init__(self, parent):
        gridlib.Grid.__init__(self, parent, -1)
        renCol = 1
        edCol = 1

        self.CreateGrid(25, 8)

        editorDemoData = [('GridCellChoiceEditor', 'one',
                          gridlib.GridCellChoiceEditor,
                          (['one', 'two', 'three', 'four',
                            'kick', 'Microsoft', 'out the',
                            'door'],
                           False))]
        row = 2
        for label, value, editorClass, args in editorDemoData:
            editor = editorClass(*args)
            self.SetCellValue(row, edCol, label)
            self.SetCellValue(row, edCol+1, value)
            self.SetCellEditor(row, edCol+1, editor)
            row = row + 2
        self.editor = editor
        print dir(self.editor)
        control = self.editor.GetControl()
        print type(control)
        print dir(control)
        
    #----------------------------------------------------------------------
    def OnLeftDClick(self, event):
        print dir(self.editor)

########################################################################
class MainFrame(wx.Frame):
    """"""
    #----------------------------------------------------------------------
    def __init__(self):
        wx.Frame.__init__(self, None, wx.ID_ANY, "Main Frame")
 
        # Add a panel so it looks the correct on all platforms
        panel = wx.Panel(self, wx.ID_ANY)
        btn = wx.Button(panel, label="New Frame")
        btn.Bind(wx.EVT_BUTTON, self.onButton)
        
    #----------------------------------------------------------------------
    def onButton(self, event):
        """"""
        frame = NewFrame()
        frame.Show()
    
# Run the program
if __name__ == "__main__":
    app = wx.PySimpleApp()
    #frame = MainFrame().Show()
    frame = NewFrame().Show()
    app.MainLoop()
