<bdo id='qusIr'></bdo><ul id='qusIr'></ul>
    1. <i id='qusIr'><tr id='qusIr'><dt id='qusIr'><q id='qusIr'><span id='qusIr'><b id='qusIr'><form id='qusIr'><ins id='qusIr'></ins><ul id='qusIr'></ul><sub id='qusIr'></sub></form><legend id='qusIr'></legend><bdo id='qusIr'><pre id='qusIr'><center id='qusIr'></center></pre></bdo></b><th id='qusIr'></th></span></q></dt></tr></i><div id='qusIr'><tfoot id='qusIr'></tfoot><dl id='qusIr'><fieldset id='qusIr'></fieldset></dl></div>
      <tfoot id='qusIr'></tfoot>

      <small id='qusIr'></small><noframes id='qusIr'>

      <legend id='qusIr'><style id='qusIr'><dir id='qusIr'><q id='qusIr'></q></dir></style></legend>

    2. 如何在 PyQt5 窗口中嵌入 pptk 查看器

      时间:2023-08-05
      • <legend id='68n6H'><style id='68n6H'><dir id='68n6H'><q id='68n6H'></q></dir></style></legend>

        • <tfoot id='68n6H'></tfoot>
            <bdo id='68n6H'></bdo><ul id='68n6H'></ul>
            1. <i id='68n6H'><tr id='68n6H'><dt id='68n6H'><q id='68n6H'><span id='68n6H'><b id='68n6H'><form id='68n6H'><ins id='68n6H'></ins><ul id='68n6H'></ul><sub id='68n6H'></sub></form><legend id='68n6H'></legend><bdo id='68n6H'><pre id='68n6H'><center id='68n6H'></center></pre></bdo></b><th id='68n6H'></th></span></q></dt></tr></i><div id='68n6H'><tfoot id='68n6H'></tfoot><dl id='68n6H'><fieldset id='68n6H'></fieldset></dl></div>
                <tbody id='68n6H'></tbody>

              <small id='68n6H'></small><noframes id='68n6H'>

                本文介绍了如何在 PyQt5 窗口中嵌入 pptk 查看器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我正在使用 PyQt5 (Qt Designer) 构建一个 GUI 程序,它也使用 pptk 库.这个库可以绘制大量的点,这对我的目的非常有趣(显示有限元后处理结果).

                I am building a GUI program with PyQt5 (Qt Designer) which also uses the pptk library. This library can plot huge amount of points which is very interesting for my purpose (display finite element post processing results).

                正如 这篇文章中所述,来自 pptk 的查看器类是一个独立的窗口.像上一篇文章的作者一样,我想将查看器嵌入到我的 GUI 中.看来我需要写一些包装器.经过一番研究,我仍然不知道这是否意味着我必须查看 C++ 代码来重新编写一些东西.在那种情况下,它会比我想象的更复杂,我将不得不暂时放弃.最后,如果我可以创建一个可以集成到我的主窗口中的查看器小部件,那将是完美的.

                As it is explained in this post, the viewer class from pptk is a standalone window. Like the author of the previous post, I would like to embed the viewer in my GUI. It seems that I need to write some wrapper. After some research, I still don't know if that means that I have to look inside the C++ code to re-write some stuff. In that case, it'll be more complex than I thought and I'll have to give up for the moment. In the end, if I could create a viewer widget that can be integrated inside my main window, it would be perfect.

                有人可以为我澄清一下我必须经历什么吗?

                Can someone please clarify for me what I have to go through?

                推荐答案

                下面是一个演示脚本,展示了如何将查看器添加到布局中.我无法在 Windows 上测试它,但在 Linux 上(没有 win32gui 部分),我得到的结果如下所示.可以看到,没有奇怪的边框,窗口可以正常自由调整大小.

                Below is a demo script that shows how to add the viewer to a layout. I cannot test it on Windows, but on Linux (without the win32gui part), I get the results show below. As you can see, there is no weird border, and the window can be freely resized as normal.

                from PyQt5 import QtWidgets, QtGui
                import numpy as np
                import pptk
                import win32gui
                import sys
                
                class MainWindow(QtWidgets.QMainWindow):
                    def __init__(self):
                        super(MainWindow, self).__init__()
                
                        widget = QtWidgets.QWidget()
                        layout = QtWidgets.QGridLayout(widget)
                        self.setCentralWidget(widget)
                
                        self.cloudpoint = np.random.rand(100, 3)
                        self.v = pptk.viewer(self.cloudpoint)
                        hwnd = win32gui.FindWindowEx(0, 0, None, "viewer")
                        self.window = QtGui.QWindow.fromWinId(hwnd)    
                        self.windowcontainer = self.createWindowContainer(self.window, widget)
                
                        layout.addWidget(self.windowcontainer, 0, 0)
                
                if __name__ == '__main__':
                
                    app = QtWidgets.QApplication(sys.argv)
                    app.setStyle("fusion")
                    form = MainWindow()
                    form.setWindowTitle('PPTK Embed')
                    form.setGeometry(100, 100, 600, 500)
                    form.show()
                    sys.exit(app.exec_())
                

                这篇关于如何在 PyQt5 窗口中嵌入 pptk 查看器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:QButtonGroup 没有使复选框独占 下一篇:PyQt 正确使用 emit() 和 pyqtSignal()

                相关文章

                最新文章

              1. <small id='8Qz8S'></small><noframes id='8Qz8S'>

              2. <tfoot id='8Qz8S'></tfoot>

                  • <bdo id='8Qz8S'></bdo><ul id='8Qz8S'></ul>
                  1. <legend id='8Qz8S'><style id='8Qz8S'><dir id='8Qz8S'><q id='8Qz8S'></q></dir></style></legend>
                    <i id='8Qz8S'><tr id='8Qz8S'><dt id='8Qz8S'><q id='8Qz8S'><span id='8Qz8S'><b id='8Qz8S'><form id='8Qz8S'><ins id='8Qz8S'></ins><ul id='8Qz8S'></ul><sub id='8Qz8S'></sub></form><legend id='8Qz8S'></legend><bdo id='8Qz8S'><pre id='8Qz8S'><center id='8Qz8S'></center></pre></bdo></b><th id='8Qz8S'></th></span></q></dt></tr></i><div id='8Qz8S'><tfoot id='8Qz8S'></tfoot><dl id='8Qz8S'><fieldset id='8Qz8S'></fieldset></dl></div>