尝试使用名为chemlab的lib在python 3.5中工作
它需要PyQT4,它需要PyOpenGL
所有这些都在64台机器上,但所有东西 - 从python到每个库都是32位(可能很重要)
初始代码是
from chemlab.graphics.qt import QtViewer
from chemlab.graphics.renderers import PointRenderer
from chemlab.graphics.uis import TextUI
vertices = [[0.0, 0.0, 0.0], [0.0, 1.0, 0.0], [2.0, 0.0, 0.0]]
blue = (0, 255, 255, 255)
colors = [blue, ] * 3
v = QtViewer()
pr = v.add_renderer(PointRenderer, vertices, colors)
tu = v.add_ui(TextUI, 100, 100, 'Hello, world!')
v.run()
Callstack如下
Traceback (most recent call last):
File "C:/Users/eldar/PycharmProjects/ChemTo3D/Proccessor.py", line 13, in <module> tu = v.add_ui(TextUI, 100, 100, 'Hello, world!')
File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\chemlab\graphics\qt\qtviewer.py", line 189, in add_ui
ui = klass(self.widget, *args, **kwargs)
File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\sitepackages\chemlab\graphics\uis.py", line 120, in __init__
props = setup_textures()
File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\chemlab\graphics\uis.py", line 17, in setup_textures
ft = ImageFont.truetype(font_name, height)
File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\PIL\ImageFont.py", line 238, in truetype
return FreeTypeFont(font, size, index, encoding)
File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\PIL\ImageFont.py", line 127, in __init__
self.font = core.getfont(font, size, index, encoding)
OSError: cannot open resource
Exception ignored in: <bound method VertexBuffer.__del__ of <chemlab.graphics.buffers.VertexBuffer object at 0x04FF7630>>
Traceback (most recent call last):
File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\chemlab\graphics\buffers.py", line 26, in __del__
File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\OpenGL\wrapper.py", line 98, in __nonzero__
File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\OpenGL\platform\baseplatform.py", line 376, in __nonzero__
File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\OpenGL\platform\baseplatform.py", line 381, in load
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 954, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 887, in _find_spec
TypeError: 'NoneType' object is not iterable
Exception ignored in: <bound method VertexBuffer.__del__ of <chemlab.graphics.buffers.VertexBuffer object at 0x04FF7D10>>
Traceback (most recent call last):
File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\chemlab\graphics\buffers.py", line 26, in __del__
File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\OpenGL\wrapper.py", line 98, in __nonzero__
File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\OpenGL\platform\baseplatform.py", line 376, in __nonzero__
File "C:\Users\eldar\AppData\Local\Programs\Python\Python35-32\lib\site-packages\OpenGL\platform\baseplatform.py", line 381, in load
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 954, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 887, in _find_spec
TypeError: 'NoneType' object is not iterable
编辑:停止显示任何内容的部分是文本。枕头根本不好玩。如果没有尝试显示文本,分子确实会显示,所以我不再确定opengl导入错误正在做什么 - 也许什么都没有,也许是着色器不可用。调查正在进行中。
答案 0 :(得分:0)
这通常是因为您缺少字体。
查看github上的代码,它正在寻找Arial.ttf&#39;: https://github.com/chemlab/chemlab/blob/cded640add8322bf315abdb155e2e21d942ae337/chemlab/graphics/uis.py#L14