Hello Devs,
I have created a plugin for blender using pyqt in the menubar, but i want it to be a part of the UI, specifically in the same area as the properties on the left side.
I searched everywhere and i can’t find a way to integrate my UI in blender’s UI and not it being another window popping up.
1 Like
Well, here is a simple example of how you can create a custom panel in blenders UI using Python and PyQt.
import bpy
import bpy.types
from bpy.types import Panel
from bpy.props import StringProperty
from bpy.utils import register_class, unregister_class
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton
# Define a custom panel class
class CustomPanel(Panel):
bl_idname = "PT_CustomPanel"
bl_label = "My Custom Panel"
bl_category = "My Add-on"
def draw(self, context):
layout = self.layout
# Create a QWidget to host PyQt UI elements
widget = QWidget()
layout.addWidget(widget)
# Create a QVBoxLayout for the PyQt UI
vbox = QVBoxLayout(widget)
# Add PyQt UI elements (e.g., QPushButton)
button = QPushButton("My Button")
vbox.addWidget(button)
# Register the custom panel class
def register():
bpy.utils.register_class(CustomPanel)
# Unregister the custom panel class
def unregister():
bpy.utils.unregister_class(CustomPanel)
# Test the custom panel in Blender
if __name__ == "__main__":
register()
Thanks
1 Like
Have you verified that this works? This seems like a low quality AI generated answer.
1 Like
Blender has a builtin UI system running on a custom tech stack. You should be using blender’s UI system for addons instead of Qt if you want anything cleanly integrated into blender.
1 Like