How to convert PyQt Gui interface running in python into module in 3D slicer

I have a GUI interface that can be runned in Python. Now I hope to intergrate the GUI into 3Dslicer. How to do it. My gui was based on PyQt5 and vtk package and 3D slicer doesn’t support PyQt5, so how to do it.My file is attached.
Another question is how to load an obj file as segmentation directly into 3D slicer with programming.
Thank you.PyQt5 code file.

From a quick look it seems your code doesn’t use much Qt, so that part of the porting may be easy. On the other hand you are doing lower-level VTK event processing and that may be harder to integrate in Slicer’s regular 3D views since events need to be managed carefully. On the other hand if you just wanted to pop up an independent 3d view window you could basically use the code you already have.

I didn’t look in detail, but it seems you are working with shortest paths on surfaces, so maybe Slicer’s curve markups can already do some of what you need. What’s the purpose of your program?

According to me Integrating a PyQt5 grounded GUI into 3D Slicer can be grueling since 3D Slicer does not support PyQt5 directly. I have a ans for your first question. You can follow this Since 3D Slicer uses Qt, you might need to rewrite your GUI to use the Qt classes that 3D Slicer supports. This will allow flawless integration; You can integrate your VTK grounded visualizations into 3D Slicer by creating custom modules. relate to the 3D Slicer attestation for guidance on creating scripted modules using Python.