PythonOCC 基本示例不起作用
PythonOCC Basic example not working
使用他们网站上的基本示例:
from OCC.Display.SimpleGui import init_display
from OCC.BRepPrimAPI import BRepPrimAPI_MakeBox
display, start_display, add_menu, add_function_to_menu = init_display()
my_box = BRepPrimAPI_MakeBox(10., 20., 30.).Shape()
display.DisplayShape(my_box, update=True)
start_display()
我无法让它运行?有什么想法吗?
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\WinPython-32bit-2.7.6.4\python-2.7.6\lib\site-packages\OCC\Display\SimpleGui.py", line 164, in init_display
win.canva.InitDriver()
File "C:\WinPython-32bit-2.7.6.4\python-2.7.6\lib\site-packages\OCC\Display\pysideDisplay.py", line 79, in InitDriver
self._display = OCCViewer.Viewer3d(self.GetHandle())
File "C:\WinPython-32bit-2.7.6.4\python-2.7.6\lib\site-packages\OCC\Display\pysideDisplay.py", line 55, in GetHandle
return int(self.winId())
TypeError: int() argument must be a string or a number, not 'PyCObject'
这是 github 问题的重复:
https://github.com/tpaviot/pythonocc-core/issues/68
我们需要知道您使用的是哪个 GUI 库以及您使用的是哪个版本的 pythonocc。
这是旧版本的pythonocc,目前你可以find here:
为什么不尝试安装更新的版本呢?
您安装的 OCE library 匹配很重要。
所以 pythonocc-core 0.16 与 OCE 0.16
使用他们网站上的基本示例:
from OCC.Display.SimpleGui import init_display
from OCC.BRepPrimAPI import BRepPrimAPI_MakeBox
display, start_display, add_menu, add_function_to_menu = init_display()
my_box = BRepPrimAPI_MakeBox(10., 20., 30.).Shape()
display.DisplayShape(my_box, update=True)
start_display()
我无法让它运行?有什么想法吗?
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\WinPython-32bit-2.7.6.4\python-2.7.6\lib\site-packages\OCC\Display\SimpleGui.py", line 164, in init_display
win.canva.InitDriver()
File "C:\WinPython-32bit-2.7.6.4\python-2.7.6\lib\site-packages\OCC\Display\pysideDisplay.py", line 79, in InitDriver
self._display = OCCViewer.Viewer3d(self.GetHandle())
File "C:\WinPython-32bit-2.7.6.4\python-2.7.6\lib\site-packages\OCC\Display\pysideDisplay.py", line 55, in GetHandle
return int(self.winId())
TypeError: int() argument must be a string or a number, not 'PyCObject'
这是 github 问题的重复:
https://github.com/tpaviot/pythonocc-core/issues/68
我们需要知道您使用的是哪个 GUI 库以及您使用的是哪个版本的 pythonocc。 这是旧版本的pythonocc,目前你可以find here:
为什么不尝试安装更新的版本呢? 您安装的 OCE library 匹配很重要。 所以 pythonocc-core 0.16 与 OCE 0.16