Ubuntu と python 2.7 で Nodebox Graph を使用しようとしています。
だから私は Nodebox OpenGL を手に入れました: http://www.cityinabottle.org/nodebox/
ノードボックス グラフ: https://www.nodebox.net/code/index.php/Graph
基本的な例1を実行しようとしました:
graph = ximport("graph")
size(500, 500)
g = graph.create()
# Create some relations.
g.add_edge("roof" , "house")
g.add_edge("garden" , "house")
g.add_edge("room" , "house")
g.add_edge("kitchen" , "room")
g.add_edge("bedroom" , "room")
g.add_edge("bathroom" , "room")
g.add_edge("living room" , "room")
g.add_edge("sofa" , "living room")
g.add_edge("table" , "living room")
# Calculate a good layout.
g.solve()
# Apply default rules for node colors and size,
# for example, important nodes become blue.
g.styles.apply()
# Draw the graph, indicating the direction of each relation
# and the two nodes that get the most traffic.
g.draw(
directed=True,
traffic=1
)
ximport が定義されていないため、それは機能しません。ノードボックスによってのみ定義されるため、代わりに 2 つのことを試しました。
def ximport(library):
from sys import modules
library = __import__(library)
library._ctx = modules[__name__]
return library
graph = ximport("graph")
size(500, 500)
g = graph.create()
# Create some relations.
g.add_edge("roof" , "house")
g.add_edge("garden" , "house")
g.add_edge("room" , "house")
g.add_edge("kitchen" , "room")
g.add_edge("bedroom" , "room")
g.add_edge("bathroom" , "room")
g.add_edge("living room" , "room")
g.add_edge("sofa" , "living room")
g.add_edge("table" , "living room")
# Calculate a good layout.
g.solve()
# Apply default rules for node colors and size,
# for example, important nodes become blue.
g.styles.apply()
# Draw the graph, indicating the direction of each relation
# and the two nodes that get the most traffic.
g.draw(
directed=True,
traffic=1
)
関数のサイズが認識されないため、まだ機能しません。サイズをコメントアウトすると、次のエラーが発生します。
self.x = _ctx.WIDTH - max.x*self.d - min_.x*self.d
AttributeError: 'NoneType' オブジェクトに属性 'WIDTH' がありません
私は何をしますか?
この質問は似ているかもしれません:
Pydev Nodebox: "AttributeError: 'NoneType' オブジェクトに属性 'WIDTH' がありません"
しかし、与えられた答えは私にはまったく役に立ちません。