#!/usr/bin/python


import wx

class Frame1(wx.Frame):
    def __init__(self, *args, **kwargs):
        wx.Frame.__init__(self, *args, **kwargs)

        self.panel1 = wx.Panel(id=1, name='panel1', parent=self,
              pos=wx.Point(16, 8), size=wx.Size(344, 192),
              style=wx.TAB_TRAVERSAL)
        
        self.button1 = wx.Button(id=3, label='open frame',
              name='button1', parent=self.panel1, pos=wx.Point(304, 16),
              size=wx.Size(75, 23), style=0)
        self.button1.Bind(wx.EVT_BUTTON, self.OnButton1Button,
              id=3)

        self.listCtrl1 = wx.ListCtrl(id=4, name='listCtrl1',
              parent=self.panel1, pos=wx.Point(56, 40), size=wx.Size(248, 152),
              style=wx.LC_REPORT)
        self.listCtrl1.Bind(wx.EVT_LIST_ITEM_SELECTED,
              self.OnListCtrl1ListItemSelected, id=4)
        self.listCtrl1.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK,
              self.OnListCtrl1ListItemRightClick, id=4)

        self.initialization()
        
       
    def initialization(self):
        
        self.listCtrl1.ClearAll() 

        self.listCtrl1.InsertColumn(0, 'id', format = 
        wx.LIST_FORMAT_LEFT, width = 20) 
        self.listCtrl1.InsertColumn(1, 'Vorname', format = 
        wx.LIST_FORMAT_LEFT, width = 90)
        self.listCtrl1.InsertColumn(2, 'Nachname', format = 
        wx.LIST_FORMAT_LEFT, width = 90)
        
        self.listCtrl1.InsertStringItem(0, 'asdf')
        self.listCtrl1.SetStringItem(0, 0, '2')
        self.listCtrl1.SetStringItem(0, 1, 'hello')
        self.listCtrl1.SetStringItem(0, 2, 'world')
        

    def OnButton1Button(self, event):
        myFrame2 = Frame2(self)
        myFrame2.Show()


    def OnListCtrl1ListItemSelected(self, event):
        myFrame2 = Frame2(self)
        myFrame2.Show()
        

    def OnListCtrl1ListItemRightClick(self, event):
        myFrame2 = Frame2(self)
        myFrame2.Show()



class Frame2(wx.Frame):
    def __init__(self, *args, **kwargs):
        wx.Frame.__init__(self, *args, **kwargs)

        self.panel1 = wx.Panel(id=1, name='panel1', parent=self,
              pos=wx.Point(16, 8), size=wx.Size(344, 192),
              style=wx.TAB_TRAVERSAL)
        
        self.staticText1 = wx.StaticText(id=2,
              label='me is frame 2', name='staticText1', parent=self.panel1,
              pos=wx.Point(120, 88), size=wx.Size(65, 13), style=0)

        
        
if __name__ == '__main__':
    app = wx.App()
    main = Frame1(None)
    main.Show()
    app.MainLoop()

