Python QT findChildren does not find any children from UI file

后端 未结 1 1442
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-11 07:09

I have a UI file like this



 RoverPlanner
 

        
相关标签:
1条回答
  • 2020-12-11 07:58

    I ever encountered a similar problem and the cause was that the library used some wrapper like python_qt_binding but another part of the code used PyQt5 or PySide2. Why does that happen? because wrappers create new classes that use the same code base but in the end they are different classes.

    My recommendation is that if you are going to use python_qt_binding then no longer use pyqt5 or pyside2 directly but rather the wrapper, in your case you should use the following:

    import os
    
    from argparse import ArgumentParser
    
    import rospy
    import rospkg
    
    from qt_gui.plugin import Plugin
    
    from python_qt_binding.QtWidgets import QWidget, QTreeView, QPushButton, QFileDialog
    from python_qt_binding import loadUi
    
    # ....
    0 讨论(0)
提交回复
热议问题