I’ve added those changes to your code, but note you have not used p and val & pos have not been defined
import wx
class MyCheckBox(wx.Frame):
def init(self):
wx.Frame.init(self, None, -1, ‘Values’, size=(490, 450))
panel = wx.Panel(self, -1)
List = [(70, 55), (170, 55), (270, 55), (370, 55),
(70, 85), (170, 85), (270, 85), (370, 85)]
self.textctrls = []
for p, v in zip(List, val):
self.textctrls.append(wx.TextCtrl(panel, -1, value=str(v), pos=pos,
size=(60, 25)))
self.btnOK = wx.Button(panel, label="OK", pos=(190, 355))
self.btnOK.Bind(wx.EVT_BUTTON, self.OnOK)
def OnOK(self, event):
self.Show(False)
for ctrl in self.textctrls:
print ctrl.GetValue()
···
On Sunday, December 22, 2013 7:54:35 AM UTC, Ibraheem Khan wrote:
thanks for reply. I don’t have much experience with wxPython and that is why your answer isn’t clear to me. Please help me understand.
On Sunday, December 22, 2013 1:49:52 AM UTC-5, Ibraheem Khan wrote:
I have following set of TextCtrl which I edit when needed.
import wx class MyCheckBox(wx.Frame):
def __init__(self): wx.Frame.__init__(self, None, -1, 'Values', size=(490, 450))
panel = wx.Panel(self, -1)
List = [(70, 55), (170, 55), (270, 55), (370, 55),
(70, 85), (170, 85), (270, 85), (370, 85)]
for p,v in zip(List,val):
self.value = wx.TextCtrl(panel, -1, value=str(v), pos=pos, size=(60,25))
self.btnOK = wx.Button(panel, label="OK", pos=(190, 355))
self.Bind(wx.EVT_BUTTON, self.OnOK, id = self.btnOK.GetId())
def OnOK(self, event):
self.Show(False)
Currently, default value for all of them is '-999'. How can I retrieve them to a list at the end of process when I press OK?