python pyinstaller Load ui Path Method
- 2021-06-28 09:26:32
- OfStack
As follows:
class Login(QMainWindow):
""" Logon window """
global status_s
global connect_signal
def __init__(self, *args):
super(Login, self).__init__(*args)
if getattr(sys,'frozen',False):
bundle_dir = sys._MEIPASS
else:
bundle_dir = os.path.dirname(os.path.abspath(__file__))
loadUi(bundle_dir+'\set_controller.ui', self)
When encapsulating with pyinstaller, use statements:
pyinstaller-w-F--add-data="set_without command line interfacecontroller.ui;. ". \"jiaben.py
pyinstaller-c-F--add-data="set_controller.ui;. ". \"jiaben.py
When adding the icon icon, add it in the spec file and run pyinstaller **.spec