I tried running the example from the documentation, but I do not see the expected files (figure_1.png and figure_2.png) being written. The script seems to finish without writing any files.
What should I change to make this script write the png files to my folder?
import time
import nglview as nv
view = nv.demo()
view
def generate_images(v=view):
v.clear()
v.add_cartoon(color='red')
im0 = v.render_image()
v.clear()
v.add_cartoon(color='blue')
im1 = v.render_image()
for im in [im0, im1]:
while not im.value:
time.sleep(0.1)
for n, im in zip('ab', [im0, im1]):
with open(f'figure_{n}.png', 'wb') as fh:
fh.write(im.value)
import threading
thread = threading.Thread(
target=generate_images,
)
thread.daemon = True
thread.start()
I ran the script like this: python3 myscript.py
I expected to see two new files in my folder, but instead I got nothing.
I tried running the example from the documentation, but I do not see the expected files (
figure_1.png
andfigure_2.png
) being written. The script seems to finish without writing any files.What should I change to make this script write the png files to my folder?
I ran the script like this:
python3 myscript.py
I expected to see two new files in my folder, but instead I got nothing.
Here are my version numbers: