A simple class derived from lib.stattext
that implements auto-wrapping
behaviour depending on the parent size.
New in version 0.9.5.
Defsult class constructor. |
|
Handles the |
|
Sets the |
|
This functions wraps the controls label so that each of its lines becomes at |
AutoWrapStaticText
(StaticText)¶A simple class derived from lib.stattext
that implements auto-wrapping
behaviour depending on the parent size.
New in version 0.9.5.
__init__
(self, parent, label)¶Defsult class constructor.
parent (wx.Window) – a subclass of wx.Window
, must not be None
;
label (string) – the AutoWrapStaticText
text label.
OnSize
(self, event)¶Handles the wx.EVT_SIZE
event for AutoWrapStaticText
.
event – a wx.SizeEvent
event to be processed.
SetLabel
(self, label, wrapped=False)¶Sets the AutoWrapStaticText
label.
All “&” characters in the label are special and indicate that the following character is
a mnemonic for this control and can be used to activate it from the keyboard (typically
by using Alt
key in combination with it). To insert a literal ampersand character, you
need to double it, i.e. use “&&”. If this behaviour is undesirable, use SetLabelText
instead.
label (string) – the new AutoWrapStaticText
text label;
wrapped (bool) – True
if this method was called by the developer using SetLabel
,
False
if it comes from the OnSize
event handler.
Note
Reimplemented from wx.Control
.
Wrap
(self, width)¶This functions wraps the controls label so that each of its lines becomes at most width pixels wide if possible (the lines are broken at words boundaries so it might not be the case if words are too long).
If width is negative, no wrapping is done.
width (integer) – the maximum available width for the text, in pixels.
Note
Note that this width is not necessarily the total width of the control, since a few pixels for the border (depending on the controls border style) may be added.