If you have 16-24 text boxes on one screen, then it's probably time to rethink your user interface. Simple is almost always better. I don't understand why you couldn't just print your messages to one or two multiline text boxes. But regardless, I think the easiest way to do this sort of thing with a dictionary. Here's an example:
import random
import wx
########################################################################
class MyPanel(wx.Panel):
""""""
#----------------------------------------------------------------------
def __init__(self, parent):
"""Constructor"""
wx.Panel.__init__(self, parent)
self.text_ctrls = {}
sizer = wx.BoxSizer(wx.VERTICAL)
for i in range(12):
txt = wx.TextCtrl(self)
self.text_ctrls[i] = txt
sizer.Add(txt, 0, wx.ALL|wx.EXPAND, 5)
btn = wx.Button(self, label="Update TextCtrls")
btn.Bind(wx.EVT_BUTTON, self.onButton)
sizer.Add(btn, 0, wx.ALL|wx.CENTER, 5)
self.SetSizer(sizer)
#----------------------------------------------------------------------
def onButton(self, event):
""""""
ctrls = self.text_ctrls.keys()
choices = ["Mon", "Tue", "Wed", "Thur", "Fri", "Sat", "Sun"]
for i in range(3):
ctrl = random.choice(ctrls)
self.text_ctrls[ctrl].SetValue(random.choice(choices))
########################################################################
class MyFrame(wx.Frame):
""""""
#----------------------------------------------------------------------
def __init__(self):
"""Constructor"""
wx.Frame.__init__(self, None, title="Test", size=(800,600))
panel = MyPanel(self)
self.Show()
#----------------------------------------------------------------------
if __name__ == "__main__":
app = wx.App(False)
frame = MyFrame()
app.MainLoop()
The basic idea is to create a series of text controls and add them to a dictionary. Then in the update button, we randomly choose a day of the week to apply to a randomly chosen text control.