I have very complicated problem. I´ve search whole internet and tried everything, but nothing worked. I want get string from listbox and than delete line in file with word from listbox. Can please somebody help me? Here is code: 
def OnDelete(self, event):
        sel = self.listbox.GetSelection()
        if sel != -1:
            self.listbox.Delete(sel)
            subor = open("Save/savegame.txt", "r")
            lines = subor.readlines()
            subor.close()
            subor = open("Save/savegame.txt", "w")
            selstring = self.listbox.GetString(self.listbox.GetSelection())
            for line in lines:
                if line!=selstring:
                    subor.write(line)
            subor.close() 
And this is code for saving file:
    def OnNewGame(self,event):
        nameofplr = wx.GetTextFromUser('Enter your name:', 'NEW GAME')
        subor=open("Save/savegame.txt","a")
        subor.write( "\n" + nameofplr)
        subor.close()
        savegame=open("Save/" + nameofplr + ".prjct", "w+")
        savegame.close()  
It shows this error:  
Traceback (most recent call last):
  File "D:\Python\Python Projects\Project\Project.py", line 106, in OnDelete
    selstring = self.listbox.GetString(self.listbox.GetSelection())
  File "D:\Python\lib\site-packages\wx-3.0-msw\wx_core.py", line 12962, in GetString
    return core.ItemContainer_GetString(*args, **kwargs)
wx._core.PyAssertionError: C++ assertion "IsValid(n)" failed at ....\src\msw\listbox.cpp(387) in wxListBox::GetString(): invalid index in wxListBox::GetString  
Thank you very much for help!
Than you very much! I have fixed it! If somebody will have the same problem you must change  OnDelete code (The first code in question) for this:  
def OnDelete(self, event):
        sel = self.listbox.GetSelection()
        f = open("Save/savegame.txt", "r")
        read = f.readlines()
        f.close()
        name = self.listbox.GetStringSelection()
        newfile = """"""
        for i in read:
            if name in i:
                pass
            else:
                newfile += i
        n = open("Save/savegame.txt", "w")
        one = str(newfile)
        n.write(one)
        n.close
        self.listbox.Delete(sel)
How to get string from listbox