Hi Haaj
The solution depends on what you want to be in the place of the TextCtrl
when it is hidden.
Does the application frame shrink when the check box is unchecked and you
hide the TextCtrl?
if mycheckbox.IsChecked():
mytextctrl.Show()
self.Layout()
else:
mytextctrl.Hide()
self.Layout()
Do you want to just "clear" and "disable" the TextCtrl so that it appears
there and "holds" its spot in the frame, but is unusable?
if mycheckbox.IsChecked():
mytextctrl.Enable()
mytextctrl.SetValue(data)
else:
mytextctrl.Clear()
mytextctrl.Disable()
Or do you want to hide the TextCtrl but still show only a blank area where
the TextCtrl would be if it were visible?
if mycheckbox.IsChecked():
mytextctrl.Show()
mypanel.Hide()
else:
mytextctrl.Hide()
mypanel.Show()
Both mytextctrl and mypanel would have to be in the same sizer.
Also a common new person mistake is to mismatch widget parents and sizer
hierarchies.
So learn about that (with Google !). It has been written about a lot all
over the place. Don't
take that as a blow off or anti-new-person sentiment. It has been asked
often and explained
really well many times and doing it again will only make it more confusing
for you, not less.
There are a lot of solutions to this question. It depends on what options
you know about.
When you "Hide" a widget there are a lot of presumptions the sequestered
has to make:
Is the TextCtrl in a dialog box, is it in its own frame/window, is it
receiving live data, is your
TextCtrl in the same window as the CheckBox, are there other auto-expanding
widgets,
are there other hide-able widgets in the same area as the TextCtrl, do you
have your sizers
and layouts well defined or are you unaware of all your sizer types. The
answers to those
questions determine what you're doing with your layout of your widgets
(i.e. sizers), which
in turn effects how your app looks and works.
Often to just get a new person up to speed it is best for them, the new
person, to provide
a simple sample application. This is requested by almost everyone having
been here longer
then a month from new people and is written about, again, all over the
place (meaning it's
easier for everyone including you for you to get the lengthy and clear
instructions from those
other "web" places that the simple sample application it is talked about in
better detail).
Google wxPython simple sample application or some such thing.