FlexGridSizer and TextCtrl issue

I have uploaded two programs-- FlexGridTest_2.py has a FlexGridSizer inside a BoxSizer (vertical) with nothing but StaticText controls and buttons. This program works fine, however I wanted to make one of the StaticText controls a multiline TextCtrl. When I do that (see FlexGridSizer.py) the TextCtrl doesn’t seem to go into the FlexGridSizer-- instead it is taking over the whole panel. I cannot figure out what I’m missing (I’m sure it’s some small detail that I’ve left out). Any ideas?

Environment:
Windows 7
python 2.7
wxpython 2.8

Thanks,
Jake

FlexGridTest.py (7.34 KB)

FlexGridTest_2.py (7.34 KB)

Hi Jake,

···

On Monday, July 8, 2013 2:50:38 PM UTC-5, Jake Larrimore wrote:

I have uploaded two programs-- FlexGridTest_2.py has a FlexGridSizer inside a BoxSizer (vertical) with nothing but StaticText controls and buttons. This program works fine, however I wanted to make one of the StaticText controls a multiline TextCtrl. When I do that (see FlexGridSizer.py) the TextCtrl doesn’t seem to go into the FlexGridSizer-- instead it is taking over the whole panel. I cannot figure out what I’m missing (I’m sure it’s some small detail that I’ve left out). Any ideas?

Environment:
Windows 7
python 2.7
wxpython 2.8

Thanks,
Jake

Looks like a parenting issue to me. Change line 88 where you put the new TextCtrl instance so that it is on the panel like the rest of the widgets. You have its parent set to “self”, so it’s causing a mess: detailsText = wx.TextCtrl(panel, -1, etc)

  • Mike

Mike—
Thanks, that was it! I knew it had to be a minor detail.
Best Regards,
Jake

···

On Monday, July 8, 2013 4:34:50 PM UTC-4, Mike Driscoll wrote:

Hi Jake,

On Monday, July 8, 2013 2:50:38 PM UTC-5, Jake Larrimore wrote:

I have uploaded two programs-- FlexGridTest_2.py has a FlexGridSizer inside a BoxSizer (vertical) with nothing but StaticText controls and buttons. This program works fine, however I wanted to make one of the StaticText controls a multiline TextCtrl. When I do that (see FlexGridSizer.py) the TextCtrl doesn’t seem to go into the FlexGridSizer-- instead it is taking over the whole panel. I cannot figure out what I’m missing (I’m sure it’s some small detail that I’ve left out). Any ideas?

Environment:
Windows 7
python 2.7
wxpython 2.8

Thanks,
Jake

Looks like a parenting issue to me. Change line 88 where you put the new TextCtrl instance so that it is on the panel like the rest of the widgets. You have its parent set to “self”, so it’s causing a mess: detailsText = wx.TextCtrl(panel, -1, etc)

  • Mike