================== 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: - :ref:`Widget (hwx.gui)` ---------- Properties ---------- +-----------+-----------+-----------+ | html_ | readonly_ | text_ | +-----------+-----------+-----------+ -------------- 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) | +------------------------------------------------------------------------------------------------------------------+ | setStyleToSection_ (self, paraFrom, indexFrom, paraTo, indexTo, color=None, size=None, bold=False, italic=False) | +------------------------------------------------------------------------------------------------------------------+ | show_ (self) | +------------------------------------------------------------------------------------------------------------------+ ---------------- Property Details ---------------- .. _html: .. property:: html The HTML formatted text. .. _readonly: .. property:: readonly Returns and sets whether text/value can be edited. .. _text: .. property:: text The text to display. -------------- Method Details -------------- .. _addChildren: .. method:: 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: .. method:: destroy(self) Deletes this and all its children. .. _enableGlobalActions: .. method:: 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: .. method:: getMousePosition(self) Returns the mouse position. .. _getRelativeMousePosition: .. method:: getRelativeMousePosition(self) Returns the mouse position relative to this widget. .. _hide: .. method:: hide(self) Hides the widget. .. _onKeyPress: .. method:: onKeyPress(self, event) Callback method when a key is pressed on the TextEdit widget. adds a new line, lets add for onCommand. :param event: Event to get key pressed. :type event: KeyEvent .. _onWheelHandler: .. method:: 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: .. method:: 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: .. method:: 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: .. method:: setProperties(self, kwds) Internal method called from constructors. .. _setStyleToSection: .. method:: setStyleToSection(self, paraFrom, indexFrom, paraTo, indexTo, color=None, size=None, bold=False, italic=False) Function to set style (color/bold/italic/size) to a particular section in text. :param paraFrom: Starting paragraph number. :type paraFrom: int :param indexFrom: Index in starting paragraph. :type indexFrom: int :param paraTo: Ending paragraph number. :type paraTo: int :param indexTo: Index in ending paragraph. :type indexTo: int :param color: Text color. It can be RGB values in form of tuple or color name. :type color: string | tuple(int) :param size: Text size. :type size: int :param bold: If True, text will be bold. :type bold: bool :param italic: If True, text will be italic. :type italic: bool .. _show: .. method:: show(self) Shows the widget.