Skip to main content
added 1 character in body; edited title
Source Link
David
  • 49.7k
  • 40
  • 162
  • 318

How to add a panel to the properties region in the text editorImage Editor?

How do I add a panel to the properties region in the textimage editor? The code below is just a slight modification from the "ui_panel_simple.py" template. I changed the bl_space_type to be the text editor, and the bl_region_type to be UI which I thought would put it in the properties region, but it does not work.

import bpy

class HelloWorld(bpy.types.Panel):
    """Creates a Panel in the Text Editor properties region"""
    bl_label = "Hello World"
    bl_idname = "OBJECT_PT_hello"
    bl_space_type = 'TEXT_EDITOR'
    bl_region_type = 'UI'

    def draw(self, context):
        layout = self.layout
        obj = context.object

        row = layout.row()
        row.label(text="Hello world in the text editor!", icon='WORLD_DATA')

def register():
    bpy.utils.register_class(HelloWorld)

def unregister():
    bpy.utils.unregister_class(HelloWorld)

if __name__ == "__main__":
    register()

How to add a panel to the properties region in the text editor?

How do I add a panel to the properties region in the text editor? The code below is just a slight modification from the "ui_panel_simple.py" template. I changed the bl_space_type to be the text editor, and the bl_region_type to be UI which I thought would put it in the properties region, but it does not work.

import bpy

class HelloWorld(bpy.types.Panel):
    """Creates a Panel in the Text Editor properties region"""
    bl_label = "Hello World"
    bl_idname = "OBJECT_PT_hello"
    bl_space_type = 'TEXT_EDITOR'
    bl_region_type = 'UI'

    def draw(self, context):
        layout = self.layout
        obj = context.object

        row = layout.row()
        row.label(text="Hello world in the text editor!", icon='WORLD_DATA')

def register():
    bpy.utils.register_class(HelloWorld)

def unregister():
    bpy.utils.unregister_class(HelloWorld)

if __name__ == "__main__":
    register()

How to add a panel to the properties region in the Image Editor?

How do I add a panel to the properties region in the image editor? The code below is just a slight modification from the "ui_panel_simple.py" template. I changed the bl_space_type to be the text editor, and the bl_region_type to be UI which I thought would put it in the properties region, but it does not work.

import bpy

class HelloWorld(bpy.types.Panel):
    """Creates a Panel in the Text Editor properties region"""
    bl_label = "Hello World"
    bl_idname = "OBJECT_PT_hello"
    bl_space_type = 'TEXT_EDITOR'
    bl_region_type = 'UI'

    def draw(self, context):
        layout = self.layout
        obj = context.object

        row = layout.row()
        row.label(text="Hello world in the text editor!", icon='WORLD_DATA')

def register():
    bpy.utils.register_class(HelloWorld)

def unregister():
    bpy.utils.unregister_class(HelloWorld)

if __name__ == "__main__":
    register()
Source Link
David
  • 49.7k
  • 40
  • 162
  • 318

How to add a panel to the properties region in the text editor?

How do I add a panel to the properties region in the text editor? The code below is just a slight modification from the "ui_panel_simple.py" template. I changed the bl_space_type to be the text editor, and the bl_region_type to be UI which I thought would put it in the properties region, but it does not work.

import bpy

class HelloWorld(bpy.types.Panel):
    """Creates a Panel in the Text Editor properties region"""
    bl_label = "Hello World"
    bl_idname = "OBJECT_PT_hello"
    bl_space_type = 'TEXT_EDITOR'
    bl_region_type = 'UI'

    def draw(self, context):
        layout = self.layout
        obj = context.object

        row = layout.row()
        row.label(text="Hello world in the text editor!", icon='WORLD_DATA')

def register():
    bpy.utils.register_class(HelloWorld)

def unregister():
    bpy.utils.unregister_class(HelloWorld)

if __name__ == "__main__":
    register()