Labels, Static Box, and Panels

Over the past two months, I managed to accumulate two sets of problems
with version 2.4.0.8 on a debian system. I was able to live with them but
am curious to know what I am missing. So I assembled them into one demo,
which is attached. The problems are:

1. The wxStaticBox and wxStaticText do not seem to support the wxWindow
styles, in particular wxSUNKEN_BORDER.

2. If I have a sizer controlling the layout of a set of wxStaticText
widgets inside a wxStaticBox or a wxPanel, I cannot get the sizer to
adjust to a change in a label.

Thanks for any comments.

problems.py (2.13 KB)

···

--
Bob Parnes
rparnes@megalink.net

Bob Parnes wrote:

1. The wxStaticBox and wxStaticText do not seem to support the wxWindow
styles, in particular wxSUNKEN_BORDER.

They may very well just not be supported on GTK. In particular,
wxStaticText on GTK is not a "real window", it is just text drawn on the
parent. You might try using a wxTextCtrl and disabling editing (
wxTE_READONLY flag )

2. If I have a sizer controlling the layout of a set of wxStaticText
widgets inside a wxStaticBox or a wxPanel, I cannot get the sizer to
adjust to a change in a label.

This one has me stumped. I did a bunch of re-factoring, to try and
figure out what is going on, and I still can't get it quite to work, but
I'm a little closer. I took one of your panels and made is a separate
class, which didn't make any difference, by the way. I alos removed one
layer of panels, and put the main sizer right on the frame. Doing this,
I could get the wxStaticBoxSizer to re-size.

The problem remaining is that if there is a panel in between the
wxStaticText and the outer sizer, it doesn't seem to work. I've spent
far to much time on this so far, so I thought I'd post what I have, and
see if anyone else can help. Example enclosed.

-Chris

problems.py (1.99 KB)

···

--
Christopher Barker, Ph.D.
Oceanographer
                                        
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Bob Parnes wrote:
> 1. The wxStaticBox and wxStaticText do not seem to support the wxWindow
> styles, in particular wxSUNKEN_BORDER.

They may very well just not be supported on GTK. In particular,
wxStaticText on GTK is not a "real window", it is just text drawn on the
parent. You might try using a wxTextCtrl and disabling editing (
wxTE_READONLY flag )

I hadn't realized that wxStaticText is not a legitimate window, having
relied on the wxwindows documentation. In any event, the wxStaticBox is a
bigger concern, because no alternative seems to exist, and I don't care
for its appearance.

> 2. If I have a sizer controlling the layout of a set of wxStaticText
> widgets inside a wxStaticBox or a wxPanel, I cannot get the sizer to
> adjust to a change in a label.

This one has me stumped. I did a bunch of re-factoring, to try and
figure out what is going on, and I still can't get it quite to work, but
I'm a little closer. I took one of your panels and made is a separate
class, which didn't make any difference, by the way. I alos removed one
layer of panels, and put the main sizer right on the frame. Doing this,
I could get the wxStaticBoxSizer to re-size.

The problem remaining is that if there is a panel in between the
wxStaticText and the outer sizer, it doesn't seem to work. I've spent
far to much time on this so far, so I thought I'd post what I have, and
see if anyone else can help. Example enclosed.

-Chris

Thanks very much for your effort. Sorry it took so much of your time. At
the moment I am using the wxPanel without sizers, set large enough to
accomodate whatever labels I dump into it.

···

On Wed, Aug 27, 2003 at 02:58:21PM -0700, Chris Barker wrote:

--
Bob Parnes
rparnes@megalink.net

Hi all,

is there any way to specify a little space around the text in a
multiline wxTextCtrl?

By default, the text gets crammed up in the top left corner. This just
doesn't look that good. What I'd love is to be able to specify a small
margin around the whole thing that wouldn't be drawn on.

I've enclosed a PNG that illustrates what I'm talking about.

-Chris

TextCtrl.png

···

--
Christopher Barker, Ph.D.
Oceanographer
                                        
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

I'm building an app where I want to show a wxDialog that contains some
controls, a wxPanel which itself contains some controls, and a group of four
wxRadioButtons. When I click on one of the radio buttons, my Python process
grabs nearly 100% of the CPU and just hangs there. Execution has not jumped
to the event handler for EVT_RADIOBUTTON (I put some print lines in there
that never appear).

If I remove the wxPanel, the radiobuttons work OK. If I leave in the
wxPanel but remove the controls from within it, the radio buttons work OK.
But as long as the wxPanel contains even one control (even a wxStaticText),
pressing a radio button hangs the system.

I'm using Python 2.3 and wxPython 2.4.1.2 on Win2K.

Does anyone know what may be causing this to happen? Thanks.

Paul Gardella

Chris Barker wrote:

The problem remaining is that if there is a panel in between the
wxStaticText and the outer sizer, it doesn't seem to work. I've spent
far to much time on this so far, so I thought I'd post what I have, and
see if anyone else can help. Example enclosed.

Use the wxADJUST_MINSIZE flag for sizer items that you want the sizer to to adjust to when they change. You can then remove all the SetItemMinSize calls in your sample.

problems.py (2.07 KB)

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Chris Barker wrote:

Hi all,

is there any way to specify a little space around the text in a
multiline wxTextCtrl?

Not via the wx API. I don't know if it is possible with platform APIs though...

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Paul Gardella wrote:

I'm building an app where I want to show a wxDialog that contains some
controls, a wxPanel which itself contains some controls, and a group of four
wxRadioButtons. When I click on one of the radio buttons, my Python process
grabs nearly 100% of the CPU and just hangs there. Execution has not jumped
to the event handler for EVT_RADIOBUTTON (I put some print lines in there
that never appear).

If I remove the wxPanel, the radiobuttons work OK. If I leave in the
wxPanel but remove the controls from within it, the radio buttons work OK.
But as long as the wxPanel contains even one control (even a wxStaticText),
pressing a radio button hangs the system.

I'm using Python 2.3 and wxPython 2.4.1.2 on Win2K.

Does anyone know what may be causing this to happen? Thanks.

This sounds like it might be a problem that was discussed not too long ago on wx-dev or wx-users. I don't remember details but I think it had something to do with the IsDialogMessage API behaving incorrectly and causing an endless supply of messages to be generated. It may also be affected by placement of the next control that can accept the focus. You may be able to find more info by looking through the archives for the past couple months.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn wrote:

Use the wxADJUST_MINSIZE flag for sizer items that you want the sizer to
to adjust to when they change. You can then remove all the
SetItemMinSize calls in your sample.

Thanks, that's much cleaner, and Yea!!! I've got it all working like it
should..whoo hoo.

It seems to me like that should be the default, but I've got it working,
so I'm happy.

Bob Parnes wrote:

Thanks very much for your effort. Sorry it took so much of your time.

I did it to try to learn something, and I did!

At the moment I am using the wxPanel without sizers, set large enough to
accomodate whatever labels I dump into it.

Bob, you may want to go back to using sizers now...

Working Code enclosed.

-Chris

problems.py (2.05 KB)

···

--
Christopher Barker, Ph.D.
Oceanographer
                                        
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

[...]

It works for me too. Thanks so very much, Chris and Robin.

Bob

···

On Thu, Aug 28, 2003 at 04:08:01PM -0700, Chris Barker wrote:

Robin Dunn wrote:
> Use the wxADJUST_MINSIZE flag for sizer items that you want the sizer to
> to adjust to when they change. You can then remove all the
> SetItemMinSize calls in your sample.

Thanks, that's much cleaner, and Yea!!! I've got it all working like it
should..whoo hoo.

It seems to me like that should be the default, but I've got it working,
so I'm happy.

Bob Parnes wrote:
> Thanks very much for your effort. Sorry it took so much of your time.

I did it to try to learn something, and I did!

> At the moment I am using the wxPanel without sizers, set large enough to
> accomodate whatever labels I dump into it.

Bob, you may want to go back to using sizers now...

Working Code enclosed.

-Chris

--
Bob Parnes
rparnes@megalink.net