Text Operators

bpy.ops.text.autocomplete()

Show a list of used text in the open document

bpy.ops.text.comment_toggle(type='TOGGLE')

Undocumented, consider contributing.

Parameters:

type (enum in ['TOGGLE', 'COMMENT', 'UNCOMMENT'], (optional)) – Type, Add or remove comments

bpy.ops.text.convert_whitespace(type='SPACES')

Convert whitespaces by type

Parameters:

type (enum in ['SPACES', 'TABS'], (optional)) – Type, Type of whitespace to convert to

bpy.ops.text.copy()

Copy selected text to clipboard

bpy.ops.text.cursor_set(x=0, y=0)

Set cursor position

Parameters:
  • x (int in [-inf, inf], (optional)) – X

  • y (int in [-inf, inf], (optional)) – Y

bpy.ops.text.cut()

Cut selected text to clipboard

bpy.ops.text.delete(type='NEXT_CHARACTER')

Delete text by cursor position

Parameters:

type (enum in ['NEXT_CHARACTER', 'PREVIOUS_CHARACTER', 'NEXT_WORD', 'PREVIOUS_WORD'], (optional)) – Type, Which part of the text to delete

bpy.ops.text.duplicate_line()

Duplicate the current line

bpy.ops.text.find()

Find specified text

bpy.ops.text.find_set_selected()

Find specified text and set as selected

bpy.ops.text.indent()

Indent selected text

bpy.ops.text.indent_or_autocomplete()

Indent selected text or autocomplete

bpy.ops.text.insert(text='')

Insert text at cursor position

Parameters:

text (string, (optional, never None)) – Text, Text to insert at the cursor position

bpy.ops.text.jump(line=1)

Jump cursor to line

Parameters:

line (int in [1, inf], (optional)) – Line, Line number to jump to

bpy.ops.text.jump_to_file_at_point(filepath='', line=0, column=0)

Edit text file in external text editor

Parameters:
  • filepath (string, (optional, never None)) – filepath

  • line (int in [-inf, inf], (optional)) – line

  • column (int in [-inf, inf], (optional)) – column

File:

startup/bl_operators/text.py:22

bpy.ops.text.jump_to_file_at_point_internal(filepath='', line=0, column=0)

Jump to a file for the internal text editor

Parameters:
  • filepath (string, (optional, never None)) – Filepath

  • line (int in [0, inf], (optional)) – Line, Line to jump to

  • column (int in [0, inf], (optional)) – Column, Column to jump to

bpy.ops.text.line_break()

Insert line break at cursor position

bpy.ops.text.line_number()

The current line number

bpy.ops.text.make_internal()

Make active text file internal

bpy.ops.text.move(type='LINE_BEGIN')

Move cursor to position type

Parameters:

type (enum in ['LINE_BEGIN', 'LINE_END', 'FILE_TOP', 'FILE_BOTTOM', 'PREVIOUS_CHARACTER', 'NEXT_CHARACTER', 'PREVIOUS_WORD', 'NEXT_WORD', 'PREVIOUS_LINE', 'NEXT_LINE', 'PREVIOUS_PAGE', 'NEXT_PAGE'], (optional)) – Type, Where to move cursor to

bpy.ops.text.move_lines(direction='DOWN')

Move the currently selected line(s) up/down

Parameters:

direction (enum in ['UP', 'DOWN'], (optional)) – Direction

bpy.ops.text.move_select(type='LINE_BEGIN')

Move the cursor while selecting

Parameters:

type (enum in ['LINE_BEGIN', 'LINE_END', 'FILE_TOP', 'FILE_BOTTOM', 'PREVIOUS_CHARACTER', 'NEXT_CHARACTER', 'PREVIOUS_WORD', 'NEXT_WORD', 'PREVIOUS_LINE', 'NEXT_LINE', 'PREVIOUS_PAGE', 'NEXT_PAGE'], (optional)) – Type, Where to move cursor to, to make a selection

bpy.ops.text.new()

Create a new text data-block

bpy.ops.text.open(filepath='', hide_props_region=True, check_existing=False, filter_blender=False, filter_backup=False, filter_image=False, filter_movie=False, filter_python=True, filter_font=False, filter_sound=False, filter_text=True, filter_archive=False, filter_btx=False, filter_collada=False, filter_alembic=False, filter_usd=False, filter_obj=False, filter_volume=False, filter_folder=True, filter_blenlib=False, filemode=9, display_type='DEFAULT', sort_method='', internal=False)

Open a new text data-block

Parameters:
  • filepath (string, (optional, never None)) – File Path, Path to file

  • hide_props_region (boolean, (optional)) – Hide Operator Properties, Collapse the region displaying the operator settings

  • check_existing (boolean, (optional)) – Check Existing, Check and warn on overwriting existing files

  • filter_blender (boolean, (optional)) – Filter .blend files

  • filter_backup (boolean, (optional)) – Filter .blend files

  • filter_image (boolean, (optional)) – Filter image files

  • filter_movie (boolean, (optional)) – Filter movie files

  • filter_python (boolean, (optional)) – Filter Python files

  • filter_font (boolean, (optional)) – Filter font files

  • filter_sound (boolean, (optional)) – Filter sound files

  • filter_text (boolean, (optional)) – Filter text files

  • filter_archive (boolean, (optional)) – Filter archive files

  • filter_btx (boolean, (optional)) – Filter btx files

  • filter_collada (boolean, (optional)) – Filter COLLADA files

  • filter_alembic (boolean, (optional)) – Filter Alembic files

  • filter_usd (boolean, (optional)) – Filter USD files

  • filter_obj (boolean, (optional)) – Filter OBJ files

  • filter_volume (boolean, (optional)) – Filter OpenVDB volume files

  • filter_folder (boolean, (optional)) – Filter folders

  • filter_blenlib (boolean, (optional)) – Filter Blender IDs

  • filemode (int in [1, 9], (optional)) – File Browser Mode, The setting for the file browser mode to load a .blend file, a library or a special file

  • display_type (enum in ['DEFAULT', 'LIST_VERTICAL', 'LIST_HORIZONTAL', 'THUMBNAIL'], (optional)) –

    Display Type

    • DEFAULT Default – Automatically determine display type for files.

    • LIST_VERTICAL Short List – Display files as short list.

    • LIST_HORIZONTAL Long List – Display files as a detailed list.

    • THUMBNAIL Thumbnails – Display files as thumbnails.

  • sort_method (enum in [], (optional)) – File sorting mode

  • internal (boolean, (optional)) – Make Internal, Make text file internal after loading

bpy.ops.text.overwrite_toggle()

Toggle overwrite while typing

bpy.ops.text.paste(selection=False)

Paste text from clipboard

Parameters:

selection (boolean, (optional)) – Selection, Paste text selected elsewhere rather than copied (X11/Wayland only)

bpy.ops.text.refresh_pyconstraints()

Refresh all pyconstraints

bpy.ops.text.reload()

Reload active text data-block from its file

bpy.ops.text.replace(all=False)

Replace text with the specified text

Parameters:

all (boolean, (optional)) – Replace All, Replace all occurrences

bpy.ops.text.replace_set_selected()

Replace text with specified text and set as selected

bpy.ops.text.resolve_conflict(resolution='IGNORE')

When external text is out of sync, resolve the conflict

Parameters:

resolution (enum in ['IGNORE', 'RELOAD', 'SAVE', 'MAKE_INTERNAL'], (optional)) – Resolution, How to solve conflict due to differences in internal and external text

bpy.ops.text.run_script()

Run active script

bpy.ops.text.save()

Save active text data-block

bpy.ops.text.save_as(filepath='', hide_props_region=True, check_existing=True, filter_blender=False, filter_backup=False, filter_image=False, filter_movie=False, filter_python=True, filter_font=False, filter_sound=False, filter_text=True, filter_archive=False, filter_btx=False, filter_collada=False, filter_alembic=False, filter_usd=False, filter_obj=False, filter_volume=False, filter_folder=True, filter_blenlib=False, filemode=9, display_type='DEFAULT', sort_method='')

Save active text file with options

Parameters:
  • filepath (string, (optional, never None)) – File Path, Path to file

  • hide_props_region (boolean, (optional)) – Hide Operator Properties, Collapse the region displaying the operator settings

  • check_existing (boolean, (optional)) – Check Existing, Check and warn on overwriting existing files

  • filter_blender (boolean, (optional)) – Filter .blend files

  • filter_backup (boolean, (optional)) – Filter .blend files

  • filter_image (boolean, (optional)) – Filter image files

  • filter_movie (boolean, (optional)) – Filter movie files

  • filter_python (boolean, (optional)) – Filter Python files

  • filter_font (boolean, (optional)) – Filter font files

  • filter_sound (boolean, (optional)) – Filter sound files

  • filter_text (boolean, (optional)) – Filter text files

  • filter_archive (boolean, (optional)) – Filter archive files

  • filter_btx (boolean, (optional)) – Filter btx files

  • filter_collada (boolean, (optional)) – Filter COLLADA files

  • filter_alembic (boolean, (optional)) – Filter Alembic files

  • filter_usd (boolean, (optional)) – Filter USD files

  • filter_obj (boolean, (optional)) – Filter OBJ files

  • filter_volume (boolean, (optional)) – Filter OpenVDB volume files

  • filter_folder (boolean, (optional)) – Filter folders

  • filter_blenlib (boolean, (optional)) – Filter Blender IDs

  • filemode (int in [1, 9], (optional)) – File Browser Mode, The setting for the file browser mode to load a .blend file, a library or a special file

  • display_type (enum in ['DEFAULT', 'LIST_VERTICAL', 'LIST_HORIZONTAL', 'THUMBNAIL'], (optional)) –

    Display Type

    • DEFAULT Default – Automatically determine display type for files.

    • LIST_VERTICAL Short List – Display files as short list.

    • LIST_HORIZONTAL Long List – Display files as a detailed list.

    • THUMBNAIL Thumbnails – Display files as thumbnails.

  • sort_method (enum in [], (optional)) – File sorting mode

bpy.ops.text.scroll(lines=1)

Undocumented, consider contributing.

Parameters:

lines (int in [-inf, inf], (optional)) – Lines, Number of lines to scroll

bpy.ops.text.scroll_bar(lines=1)

Undocumented, consider contributing.

Parameters:

lines (int in [-inf, inf], (optional)) – Lines, Number of lines to scroll

bpy.ops.text.select_all()

Select all text

bpy.ops.text.select_line()

Select text by line

bpy.ops.text.select_word()

Select word under cursor

bpy.ops.text.selection_set()

Set text selection

bpy.ops.text.start_find()

Start searching text

bpy.ops.text.to_3d_object(split_lines=False)

Create 3D text object from active text data-block

Parameters:

split_lines (boolean, (optional)) – Split Lines, Create one object per line in the text

bpy.ops.text.unindent()

Unindent selected text

Unlink active text data-block