Node Editor Tutorial 39: How to Implement Drag & Drop in PyQt5

preview_player
Показать описание

In this Node Editor tutorial we are going to implement drag & drop functionality for our application. We will continue from last episode, where we created draggable list box widget.
Рекомендации по теме
Комментарии
Автор

Hi Pavel,
It is really becoming a nice slick interface now!
Thank you very much for doing this.

OhGoOn
Автор

Hey its massive work... and that too line by line explaination really appreciated

prashantmulay
Автор

Is it possible to modify the drag and drop in such a way that if you drag the node into a browser a specific site is called? For example an documentation for the node.
And by the way great tutorial!

roni-
Автор

Hey Pavel, I have on more question:) I want to use a Toolbar to add a Node to the middle of the scene (so Koordinates 0, 0) via a click of a button. Just to keep it simple :) So no Drag and Drop for me.

I build the Toolbar and everthings works so far but adding the node to the scene is not really working well for me:, D


This is in the .py where we also init the menu and co.

....

# initialize toolbar

toolbar = QToolBar("my main toolbar") #works
toolbar.setIconSize(QSize(16, 16)) #works too
self.addToolBar(toolbar) #works
"first button"
button_action = QAction(QIcon("addBox.png"), "New box", self) #works
a new Box") # works
# error

....



and i just thought I can use the normal addboxes can modify it to:


def addnewBox(self):
box = Box(self.scene, "Box", inputs=[0, 0, 0], outputs=[1])
box.setPos(0, 0)



Of course I import class Box (in your tutorial its Node) and the class Scene.
But I get the error:
TypeError: argument 1 has unexpected type 'NoneType'
I am a bit lost :(

sebastianhall