TextEdit (hwx.gui)¶
A TextEdit Widget.
It is used to display and modify formatted and HTML text. It can be editable or not. Ctrl+Wheel zooms in/out.
- Inherits:
Properties¶
Public Methods¶
addChildren (self, children)
destroy (self)
enableGlobalActions (self, enable)
getMousePosition (self)
getRelativeMousePosition (self)
hide (self)
onKeyPress (self, event)
onWheelHandler (self, event)
saveAsPng (self, fname)
setF1HelpTopic (self, helptopic)
setProperties (self, kwds)
show (self)
Property Details¶
- property html¶
The HTML formatted text.
- property readonly¶
Returns and sets whether text/value can be edited.
- property text¶
The text to display.
Method Details¶
- addChildren(self, children)¶
Add child widgets/layouts into this widget.
Widget children get layed out using a VBoxLayout.
Typically, you’ll pass the parent/children into the constructor instead of calling this function directly.
- param children
- type children
list[Widget] | Layout
- destroy(self)¶
Deletes this and all its children.
- enableGlobalActions(self, enable)¶
Sets the state of Global Actions.
Disable the global actions to get key events.
- param enable
Determines whether to enable or disable global actions.
- type enable
bool
- getMousePosition(self)¶
Returns the mouse position.
- getRelativeMousePosition(self)¶
Returns the mouse position relative to this widget.
- hide(self)¶
Hides the widget.
- onKeyPress(self, event)¶
Callback method when a key is pressed on the TextEdit widget.
<Ret> adds a new line, lets add <Shift+Ret> for onCommand.
- param event
Event to get key pressed.
- type event
KeyEvent
- onWheelHandler(self, event)¶
Callback method when the mouse wheel is rotated inside the TextEdit widget.
Ctrl+Wheel Zooms in/out.
- param event
The key event to capture the ctrl pressed and mouse wheel event to determine if is used zoom in or out.
- type event
KeyEvent, MouseEvent
- saveAsPng(self, fname)¶
Saves the widget as a .png file.
- param fname
The file name for the .png
- type fname
str
- returns
True if it was saved succesfully, False otherwise.
- rtype
bool
- setF1HelpTopic(self, helptopic)¶
Popup web-browser helps when the user hits F1 when over this.
- param helptopic
Topic name user needs help in.
- type helptopic
str
- setProperties(self, kwds)¶
Internal method called from constructors.
- show(self)¶
Shows the widget.