I have a simply code:
import wxclass Glowne(wx.Panel): def __init__(self, parent): wx.Panel.__init__(self, parent=parent) pos = 55 tekst = 'HELLO - position' font = wx.Font(18, wx.DEFAULT, wx.NORMAL, wx.NORMAL) wx.StaticText(self, -1, tekst, (300, pos)).SetFont(font) btn = wx.Button(self, -1, "Change pos", (345, 100)) #self.Bind(wx.EVT_BUTTON, Program.zmiana, btn)class Program(wx.Frame): def __init__(self): wx.Frame.__init__(self, None, wx.ID_ANY,'Program') panel_one = Glowne(self) self.SetSize((800,600)) self.Centre()if __name__ == "__main__": app = wx.App(False) frame = Program() frame.Show() app.MainLoop()
How can I modyfy pos variable after hitting "Change pos" button?In my real program I have something like: name name1 name2
"BUTTTON"
I would like to add wx.TextCtrl method between name2 and button after hitting "BUTTON". I need to modyfy a frame (add place beetwen name2 and button). I do not know how can I achieve that.
EDIT. There is a code I need to modify:
def __init__(self, parent): global odstep self.panel = wx.Panel.__init__(self, parent) odstep = 0 odstep1 = 0 font = wx.Font(13, wx.DEFAULT, wx.NORMAL, wx.NORMAL) for name in config['rewir1']: nazwa_zliczana = config['rewir1'][name] odstep += 22 self.name1 = wx.StaticText(self, -1, name, (300, 10 + odstep)) self.name1.SetFont(font) btn_usuwanie = wx.Button(self, -1, u"Usuń", (475, 10 + odstep)) self.Bind(wx.EVT_BUTTON, lambda evt, i: Program.Usuwanie(evt, i), btn_usuwanie) wx.StaticText(self, -1, 'PART I', (365, 0), style=wx.ALIGN_CENTER).SetFont(font) odstep1 = odstep + 50 print odstep for name in config['rewir2']: nazwa_zliczana = config['rewir2'][name] odstep1 += 22 self.name2 = wx.StaticText(self, -1, name, (300, 50 + odstep1)) self.name2.SetFont(font) btn_usuwanie_2 = wx.Button(self, -1, u"Usuń", (475, 50 + odstep1)) self.Bind(wx.EVT_BUTTON, lambda evt, i: Program.Usuwanie(evt, i), btn_usuwanie_2) print odstep1 wx.StaticText(self, -1, 'PART II', (365, 80 + odstep), style=wx.ALIGN_CENTER).SetFont(font) self.btn = wx.Button(self, -1, "Change panel", (345, 500)) self.btn_dodaj_rewir1 = wx.Button(self, -1, "Add name", (345, 42 + odstep)) self.btn_dodaj_rewir2 = wx.Button(self, -1, "Add name", (345, 84 + odstep1)) self.Bind(wx.EVT_BUTTON, self.new_name, self.btn_dodaj_rewir1)