Blender python addon code making a new window
To create a new window in Blender using Python, you can use the bpy.ops.wm.window_new() operator. This operator will create a new top-level window in Blender, which you can then use to display your own custom user interface.
Here's an example of how you might use this operator in a Blender Python addon:
import bpy
class MyAddonPanel(bpy.types.Panel):
"""Creates a panel in the Object properties window"""
bl_label = "My Addon Panel"
bl_idname = "OBJECT_PT_my_addon_panel"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "object"
def draw(self, context):
layout = self.layout
# Add a button to create a new window
layout.operator("wm.window_new")
def register():
bpy.utils.register_class(MyAddonPanel)
def unregister():
bpy.utils.unregister_class(MyAddonPanel)
if __name__ == "__main__":
register()
Comments
Post a Comment