def BaDialog(self, evt): head = 'insert python commands below' dialg = MyDialogs.MyTextDialog(self.gui, 'Batch program', head, self.lastBatch) retour = dialg.ShowModal() if retour == wx.ID_OK: txt = dialg.GetText() #dialg.GetTextAsList() self.lastBatch = txt txt1 = txt.replace('model', 'self.gui.model') exec(txt1) ## for t in lst: ## self.lastBatch+=t+'\n' ## t1=t.replace('model','self.gui.model') ## exec(t1) else: return dialg.Destroy()