I am experimenting with a script where the main frame will be divided into a left and right panel. A calculator/button arrangement will be on the right and some static text on the left. Depending on the size of the main window, the text in the static text widget in the left panel is partially obscured by the right panel. A few questions:
Shouldn’t the text “fit” itself to panel1 since it is a child of panel1?
Shouldn’t it wrap so that it is contained in panel1, and shouldn’t the place where it wraps change as the window is made larger and smaller?
Also, why does the text wrap where it does?
The code for the script is attached.
I am experimenting with a script where the main frame will be divided
into a left and right panel. A calculator/button arrangement will be on
the right and some static text on the left. Depending on the size of the
main window, the text in the static text widget in the left panel is
partially obscured by the right panel. A few questions:
* Shouldn't the text "fit" itself to panel1 since it is a child of
panel1?
No, it is perfectly legal for a widget to not fit on its parent. You can force it to behave that way if you want, but it does not do it by default.
* Shouldn't it wrap so that it is contained in panel1, and shouldn't
the place where it wraps change as the window is made larger and
smaller?
wx.StaticText doesn't auto-wrap[1], it breaks lines at the newlines in the label text.
[1] Although the native widget on some platforms do it by default, wx does not specify that they should.
* Also, why does the text wrap where it does?
Because of the \n in your text. (Since you used a triple-quoted string Python inserted a \n in the string constant where the line breaks in the source code.)
Probably the easiest way to accomplish this would be to use a TextCtrl
that's disabled and has the no border style. Of course, I think that
might have a scrollbar though.
···
On Feb 23, 7:02 am, "R. P. Hintze" <rphin...@earthlink.net> wrote:
I am experimenting with a script where the main frame will be divided into a
left and right panel. A calculator/button arrangement will be on the right
and some static text on the left. Depending on the size of the main window,
the text in the static text widget in the left panel is partially obscured
by the right panel. A few questions:
* Shouldn't the text "fit" itself to panel1 since it is a child of
panel1?
* Shouldn't it wrap so that it is contained in panel1, and shouldn't
the place where it wraps change as the window is made larger and smaller?
* Also, why does the text wrap where it does?