NBA-Search icon indicating copy to clipboard operation
NBA-Search copied to clipboard

Implemented push, pop and export func

Open V1TO-C opened this issue 4 years ago • 1 comments

Added push, pop and export func.

def push(self, node): Push a node into the tree. Parameter: Node to push

def pop(self, name): Pop node from tree by setting its parent to None. Parameter: Name of node to pop

def export(self, file="tree"): export tree to PNG. Graphviz needs to be installed, may cause problems.

V1TO-C avatar Nov 06 '20 20:11 V1TO-C

I am receiving an error when trying to render the tree:

$ python visualize.py 
Traceback (most recent call last):
  File "visualize.py", line 32, in <module>
    main()
  File "visualize.py", line 29, in main
    tree.export()
  File "~/projects/NBA-Search/lab/tree_builder.py", line 48, in export
    RenderTreeGraph(self.root).to_picture(file+".png")
  File "/anaconda3/envs/home/lib/python3.7/site-packages/anytree/exporter/dotexporter.py", line 272, in to_picture
    check_call(cmd)
  File "/anaconda3/envs/home/lib/python3.7/subprocess.py", line 323, in check_call
    retcode = call(*popenargs, **kwargs)
  File "/anaconda3/envs/home/lib/python3.7/subprocess.py", line 304, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/anaconda3/envs/home/lib/python3.7/subprocess.py", line 756, in __init__
    restore_signals, start_new_session)
  File "/anaconda3/envs/home/lib/python3.7/subprocess.py", line 1499, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'dot': 'dot'

Also can you add any extra dependencies to requirements.txt?

skekre98 avatar Nov 10 '20 20:11 skekre98