appear a textCtrl when a checkbox is enabled and disappear when the checkbox is disabled??

Dear All,

I’m new to wxpython. I created a simple application and I have a checkbox inside it. I need a textCtrl appear when the checkbox is enabled and disappear when the checkbox is disabled. I know how to make textCtrl to appear, but don’t know how to disappear after checkbox being disabled. Please help me.

Thanks,

Malek

You must have found the Show() method to cause the control to be shown, but you missed the corresponding Hide() method.

···

On Aug 2, 2015, at 2:20 PM, haaj.malek@gmail.com wrote:

I'm new to wxpython. I created a simple application and I have a checkbox inside it. I need a textCtrl appear when the checkbox is enabled and disappear when the checkbox is disabled. I know how to make textCtrl to appear, but don't know how to disappear after checkbox being disabled. Please help me.


Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

How can I use the Show() and Hide() methods. Could you please give me an example for just these methods.
Thanks,

···

On Monday, August 3, 2015 at 2:27:14 AM UTC-3, Tim Roberts wrote:

On Aug 2, 2015, at 2:20 PM, haaj....@gmail.com wrote:

I’m new to wxpython. I created a simple application and I have a checkbox inside it. I need a textCtrl appear when the checkbox is enabled and disappear when the checkbox is disabled. I know how to make textCtrl to appear, but don’t know how to disappear after checkbox being disabled. Please help me.

You must have found the Show() method to cause the control to be shown, but you missed the corresponding Hide() method.


Tim Roberts, ti...@probo.com

Providenza & Boekelheide, Inc.

I apologize if this seems harsh, but there is NO WAY you should have
asked this question. I am quite patient when it comes to answering
technical questions, but I cannot tolerate someone who is totally
unwilling to help themselves.

Go look it up. The documentation is quite clear, and the wxPython demo
has many examples.

···

haaj.malek@gmail.com wrote:

How can I use the Show() and Hide() methods. Could you please give me
an example for just these methods.

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

OK. Thanks!!! for long answering rather than saying a NO.

···

On Mon, Aug 3, 2015 at 8:51 PM, Tim Roberts timr@probo.com wrote:

haaj.malek@gmail.com wrote:

How can I use the Show() and Hide() methods. Could you please give me

an example for just these methods.

I apologize if this seems harsh, but there is NO WAY you should have

asked this question. I am quite patient when it comes to answering

technical questions, but I cannot tolerate someone who is totally

unwilling to help themselves.

Go look it up. The documentation is quite clear, and the wxPython demo

has many examples.

Tim Roberts, timr@probo.com

Providenza & Boekelheide, Inc.

You received this message because you are subscribed to a topic in the Google Groups “wxPython-users” group.

To unsubscribe from this topic, visit https://groups.google.com/d/topic/wxpython-users/ci2I8XZ-TG0/unsubscribe.

To unsubscribe from this group and all its topics, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

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.

BTW people here respond pretty fast when there is a simple sample app you
provide. Usually we copy you code to local file and run it or tweak lines
in your code and reply with that. Just look at the forums previous posts. A
simple sample app.py from you would likely be perhaps about as many lines,
but not likely very much longer, as my previous reply.

Hi Dev,

First of all, thank you very much for your comprehensive and useful info on my question. Second, I’ll provide a sample app hereafter to more clarify my question.

···

On Sunday, August 9, 2015 at 8:58:18 PM UTC-3, DevPlayer wrote:

BTW people here respond pretty fast when there is a simple sample app you provide. Usually we copy you code to local file and run it or tweak lines in your code and reply with that. Just look at the forums previous posts. A simple sample app.py from you would likely be perhaps about as many lines, but not likely very much longer, as my previous reply.