@@ -44,63 +44,12 @@ applications.
4444<img src =" /docs/_images/nodes_palette.png " width =" 350 " title =" Nodes Paletten " >
4545<img src =" /docs/_images/nodes_tree.png " width =" 250 " title =" Nodes Tree " >
4646
47- #### Example
48-
49- ``` python
50- import sys
51-
52- from NodeGraphQt import QtWidgets
53- from NodeGraphQt import NodeGraph, BaseNode, BackdropNode, setup_context_menu
54-
55- # create a example node object with a input/output port.
56- class MyNode (BaseNode ):
57- """ example test node."""
58-
59- # unique node identifier domain. ("com.chantasticvfx.MyNode")
60- __identifier__ = ' com.chantasticvfx'
61-
62- # initial default node name.
63- NODE_NAME = ' My Node'
64-
65- def __init__ (self ):
66- super (MyNode, self ).__init__ ()
67- self .add_input(' foo' , color = (180 , 80 , 0 ))
68- self .add_output(' bar' )
69-
70-
71- if __name__ == ' __main__' :
72- app = QtWidgets.QApplication(sys.argv)
73-
74- # create the node graph controller.
75- graph = NodeGraph()
76-
77- # set up default menu and commands.
78- setup_context_menu(graph)
79-
80- # register backdrop node. (included in the NodeGraphQt module)
81- graph.register_node(BackdropNode)
82-
83- # register example node into the node graph.
84- graph.register_node(MyNode)
85-
86- # create nodes.
87- node_a = graph.create_node(' com.chantasticvfx.MyNode' , name = ' Node A' )
88- node_b = graph.create_node(' com.chantasticvfx.MyNode' , name = ' Node B' , color = ' #5b162f' )
89- backdrop = graph.create_node(' nodeGraphQt.nodes.Backdrop' , name = ' Backdrop' )
90-
91- # wrap "backdrop" node around "node_a" and "node_b"
92- backdrop.wrap_nodes([node_a, node_b])
93-
94- # connect "node_a" input to "node_b" output.
95- node_a.set_input(0 , node_b.output(0 ))
96-
97- # auto layout nodes.
98- graph.auto_layout_nodes()
99-
100- # show the node graph widget.
101- graph_widget = graph.widget
102- graph_widget.show()
103-
104- app.exec_()
105- ```
47+ #### Examples
48+
49+ See the [ basic_example.py] ( /basic_example.py ) python script in this repo.
50+
51+ More examples can be found in the API documentation here:
52+
53+ https://jchanvfx.github.io/NodeGraphQt/api/html/examples/ex_overview.html#simple-example
54+
10655
0 commit comments