我有一个pyqt应用程序,单击该按钮即可启动pptk点云查看器(查看器窗口作为独立的操作系统进程启动)。当我通过python解释器运行应用程序时,此方法运行良好,但是当我使用Pyinstaller冻结它并运行冻结的应用程序时,查看器窗口不会启动。没有错误消息,什么也没有发生。我在Windows 10系统上。
我认为这可能与this有关,因为我似乎没有那个图书馆。还是其他进程阻止了查看器的启动?任何想法将不胜感激。
代码的相关部分如下:
class Window(QWidget):
def __init__(self):
super().__init__()
if not QApplication.instance():
app = QApplication(sys.argv)
else:
app = QApplication.instance()
# Define variables which will hold the picked GCPs #
self.GCPs_im = np.empty([0,2])
self.GCPs_lidar = np.empty([0,3])
####################################################
# Right contents box setup #
self.introLab = QLabel('Welcome to the GCP picking module! Here, you will be guided through the process of co-locating points in the image and the lidar observations. You must identify the correspondence of at least 3 unique points for the calibration to work.')
self.introLab.setWordWrap(True)
self.goLab = QLabel('Ready to co-locate a point?:')
self.goBut = QPushButton('Go')
self.rightGroupBox = QGroupBox()
self.grd = QGridLayout()
self.grd.addWidget(self.goBut,7,3,1,1)
self.grd.addWidget(self.goLab,7,0,1,1)
self.grd.addWidget(self.introLab,0,0,1,4)
self.grd.addWidget(self.canvas,2,0,4,4)
self.rightGroupBox.setLayout(self.grd)
###############################
# Connect widgets with signals #
self.goBut.clicked.connect(self.getPoints1)
################################
# Instantiate worker threads #
self.worker = pptkWindowWorker()
self.worker.finishSignal.connect(self.on_CloseSignal)
##############################
# Full widget layout setup #
fullLayout = QGridLayout()
fullLayout.addWidget(leftGroupBox,0,0,2,2)
fullLayout.addWidget(self.rightGroupBox,0,3,2,4)
self.setLayout(fullLayout)
self.show()
############################
def getPoints1(self):
self.worker.start()
def on_CloseSignal(self):
self.goBut.setParent(None)
self.goLab.setParent(None)
self.introLab.setParent(None)
self.helpBut = QPushButton('Help')
class pptkWindowWorker(QThread):
finishSignal = pyqtSignal('PyQt_PyObject')
def __init__(self):
super().__init__()
def run(self):
print('Thread Started')
f = open('lidarPC.pkl','rb')
pc = pickle.load(f)
v = pptk.viewer(pc,pc.iloc[:,2])
v.set(point_size=0.1,theta=-25,phi=0,lookat=[0,0,20],color_map_scale=[-1,3],r=0)
self.finishSignal.emit(1)
print('Thread Done')
if __name__ == '__main__':
import sys
from PyQt5 import QtWidgets
if not QtWidgets.QApplication.instance():
app = QtWidgets.QApplication(sys.argv)
else:
app = QtWidgets.QApplication.instance()
w = WelcomeWindow()
sys.exit(app.exec_())