Source code for lightningchart_trader.drawing_tools.text_box

from lightningchart_trader.drawing_tools import DrawingToolBase


[docs] class TextBox(DrawingToolBase): def __init__(self, trader, positionX, positionY, text='Text', textColor='#000000'): super().__init__(trader) self.instance.send( self.id, 'addTextBox', { 'traderID': trader.id, 'positionX': positionX, 'positionY': positionY, 'text': text, 'textColor': textColor, }, )
[docs] def set_border_color(self, color: str): """Sets the border color of the text box. Args: color (str): New border color as string, should be in HEX format e.g. #FFFFFF. """ self.instance.send(self.id, 'setBorderColor', {'color': color}) return self
[docs] def set_border_width(self, width: int | float): """Sets the border width of the text box. Args: width (int | float): New border width. """ self.instance.send(self.id, 'setBorderWidth', {'width': width}) return self
[docs] def set_fill_color(self, color: str): """Sets the fill color of the text box. Args: color (str): New fill color as string, should be in HEX format e.g. #FFFFFF. """ self.instance.send(self.id, 'setFillColor', {'color': color}) return self
[docs] def set_font_size(self, fontSize: int | float): """Sets the font size of the text. Args: fontSize (int | float): New font size for the text. """ self.instance.send(self.id, 'setFontSize', {'fontSize': fontSize}) return self
[docs] def set_text(self, text: str): """Sets the text. Args: text (str): New text. """ self.instance.send(self.id, 'setText', {'text': text}) return self
[docs] def set_text_color(self, color: str): """Sets the color of the text. Args: color (str): New text color as string, should be in HEX format e.g. #FFFFFF. """ self.instance.send(self.id, 'setTextColor', {'color': color}) return self
[docs] def update_position(self, positionX: int | float, positionY: int | float): """Updates the position of the text. Args: positionX (int | float): Text X-position. positionY (int | float): Text Y-position. """ self.instance.send( self.id, 'updateTextBoxPosition', {'positionX': positionX, 'positionY': positionY}, ) return self