We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I got the error when test the following code `using PyCall
sys = pyimport("sys") pygui(:qt) PyCall.eventloops[:qt] = PyCall.qt_eventloop("PySide2", 50e-3) QtWidgets = pyimport("PySide2.QtWidgets") QtCore = pyimport("PySide2.QtCore") QtGui = pyimport("PySide2.QtGui") qvtk_window = pyimport("vtk.qt.QVTKRenderWindowInteractor") vtk = pyimport("vtk") pv = pyimport("pyvista")
app = QtWidgets.QApplication(sys.argv) main_window = QtWidgets.QMainWindow()
frame = QtWidgets.QFrame() vtk_widget = qvtk_window.QVTKRenderWindowInteractor(frame) the last line(vtk_widget = qvtk_window.QVTKRenderWindowInteractor(frame)) throw ERROR: PyError ($(Expr(:escape, :(ccall(#= C:\Users***.julia\packages\PyCall\zqDXB\src\pyfncall.jl:43 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class 'TypeError'> TypeError("QWidget(parent: QWidget = None, flags: Union[Qt.WindowFlags, Qt.WindowType] = Qt.WindowFlags()): argument 1 has unexpected type 'PySide2.QtWidgets.QFrame'") File "D:\Python\Python37\lib\site-packages\vtkmodules\qt\QVTKRenderWindowInteractor.py", line 260, in init QWidget.init(self, parent, wflags | Qt.MSWindowsOwnDC)However, the origin python code is work well,import sys import vtk from PySide2 import QtCore, QtGui, QtWidgets from vtk.qt.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor
the last line(vtk_widget = qvtk_window.QVTKRenderWindowInteractor(frame)) throw
However, the origin python code is work well,
app = QtWidgets.QApplication(sys.argv)
window = QtWidgets.QMainWindow() frame = QtWidgets.QFrame() vl = QtWidgets.QVBoxLayout() vtkWidget = QVTKRenderWindowInteractor(frame) vl.addWidget(vtkWidget) ren = vtk.vtkRenderer() vtkWidget.GetRenderWindow().AddRenderer(ren) iren = vtkWidget.GetRenderWindow().GetInteractor()
source = vtk.vtkSphereSource() source.SetCenter(0, 0, 0) source.SetRadius(5.0)
mapper = vtk.vtkPolyDataMapper() mapper.SetInputConnection(source.GetOutputPort())
actor = vtk.vtkActor() actor.SetMapper(mapper)
ren.AddActor(actor)
ren.ResetCamera()
frame.setLayout(vl) window.setCentralWidget(frame)
window.show() iren.Initialize()
sys.exit(app.exec_()) `
The Code running environment is: Win 10 professional, Vtk version is 9.0.1. Thanks by advance for any help :)
The text was updated successfully, but these errors were encountered:
I just found that it works if I comment pygui(:qt) PyCall.eventloops[:qt] = PyCall.qt_eventloop("PySide2", 50e-3) So should I comment them?
pygui(:qt) PyCall.eventloops[:qt] = PyCall.qt_eventloop("PySide2", 50e-3)
Sorry, something went wrong.
If you are running your own event loop, you shouldn't call pygui at all.
pygui
No branches or pull requests
I got the error when test the following code
`using PyCall
sys = pyimport("sys")
pygui(:qt)
PyCall.eventloops[:qt] = PyCall.qt_eventloop("PySide2", 50e-3)
QtWidgets = pyimport("PySide2.QtWidgets")
QtCore = pyimport("PySide2.QtCore")
QtGui = pyimport("PySide2.QtGui")
qvtk_window = pyimport("vtk.qt.QVTKRenderWindowInteractor")
vtk = pyimport("vtk")
pv = pyimport("pyvista")
app = QtWidgets.QApplication(sys.argv)
main_window = QtWidgets.QMainWindow()
frame = QtWidgets.QFrame()
vtk_widget = qvtk_window.QVTKRenderWindowInteractor(frame)
the last line(vtk_widget = qvtk_window.QVTKRenderWindowInteractor(frame)) throw
ERROR: PyError ($(Expr(:escape, :(ccall(#= C:\Users***.julia\packages\PyCall\zqDXB\src\pyfncall.jl:43 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw))))) <class 'TypeError'>TypeError("QWidget(parent: QWidget = None, flags: Union[Qt.WindowFlags, Qt.WindowType] = Qt.WindowFlags()): argument 1 has unexpected type 'PySide2.QtWidgets.QFrame'")
File "D:\Python\Python37\lib\site-packages\vtkmodules\qt\QVTKRenderWindowInteractor.py", line 260, in init
QWidget.init(self, parent, wflags | Qt.MSWindowsOwnDC)
However, the origin python code is work well,
import sysimport vtk
from PySide2 import QtCore, QtGui, QtWidgets
from vtk.qt.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor
app = QtWidgets.QApplication(sys.argv)
window = QtWidgets.QMainWindow()
frame = QtWidgets.QFrame()
vl = QtWidgets.QVBoxLayout()
vtkWidget = QVTKRenderWindowInteractor(frame)
vl.addWidget(vtkWidget)
ren = vtk.vtkRenderer()
vtkWidget.GetRenderWindow().AddRenderer(ren)
iren = vtkWidget.GetRenderWindow().GetInteractor()
Create source
source = vtk.vtkSphereSource()
source.SetCenter(0, 0, 0)
source.SetRadius(5.0)
Create a mapper
mapper = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(source.GetOutputPort())
Create an actor
actor = vtk.vtkActor()
actor.SetMapper(mapper)
ren.AddActor(actor)
ren.ResetCamera()
frame.setLayout(vl)
window.setCentralWidget(frame)
window.show()
iren.Initialize()
sys.exit(app.exec_())
`
The Code running environment is: Win 10 professional, Vtk version is 9.0.1.
Thanks by advance for any help :)
The text was updated successfully, but these errors were encountered: