I am attempting to added checkboxes to a wxpython gui during runtime, but it does not seem to be showing up. My code is below.
I have tried following the post < Add checkbox in wxPython in runtime >, but was not able to get it to work. I also used wxFormBuilder to see how it adds a checkbox during initialization; I was able to verify that self.mainWindow.p_SelectionPanel is where I want to add the checkbox. I have also checked with the debugger to ensure that each line of the code is run at least once.
A little more background about the application: it is a wxPython GUI with a matplotlib plot embedded into it. I am trying to generate checkboxes from an incoming serial port stream so the user can show/hide series during runtime. point is a dictionary with the key as the series name and the series value as the dictionary value.
Please let me know if you need more context.
Thanks in advance for the help.
def addNewCheckBoxes(self,point):
sizer = self.mainWindow.p_SelectionPanel.GetSizer()
addedCheckBox = False
for key in point.keys():
if key not in self.cbList.keys():
self.cbList[key] = wx.CheckBox(self.mainWindow.p_SelectionPanel)
sizer.Add(self.cbList[key])
addedCheckBox = True
if addedCheckBox:
self.mainWindow.p_SelectionPanel.SetSizer(sizer)
self.mainWindow.p_SelectionPanel.Layout()