python pyinstaller 加载ui路径方法

作者:sg-expert 时间:2023-06-12 23:27:20 

如下所示:


class Login(QMainWindow):
 """登录窗口"""
 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)

使用pyinstaller进行封装时,使用语句:

不带命令行界面 pyinstaller -w -F --add-data="set_controller.ui;." .\jiaben.py 

带命令行界面    pyinstaller -c -F --add-data="set_controller.ui;." .\jiaben.py 

添加icon图标时,在spec文件中添加,然后运行pyinstaller **.spec

来源:https://blog.csdn.net/zjc156m/article/details/78771132

标签:python,pyinstaller,ui
0
投稿

猜你喜欢

  • 详解Windows Server 2012下安装MYSQL5.7.24的问题

    2024-01-27 10:20:37
  • Vue.js通用应用框架-Nuxt.js的上手教程

    2024-04-28 10:54:31
  • Gregarius中文日期格式问题解决办法

    2023-11-18 09:51:00
  • Python的log日志功能及设置方法

    2022-03-28 22:13:32
  • Python中使用PIL库实现图片高斯模糊实例

    2023-12-09 14:12:20
  • python清除字符串中间空格的实例讲解

    2023-12-29 22:40:24
  • Javascript常用运算符(Operators)-javascript基础教程

    2024-04-17 10:10:51
  • Python离线安装包教程分享

    2023-08-03 18:16:40
  • python中使用%与.format格式化文本方法解析

    2023-09-21 18:02:11
  • 可以改善mysql性能的InnoDB配置参数

    2024-01-27 05:25:37
  • vue.js实现简易折叠面板

    2024-05-08 09:33:47
  • SQLServer数据库密码短时间强制过期的解决

    2024-01-18 09:40:01
  • python使用心得之获得github代码库列表

    2023-12-01 21:31:51
  • 用C++封装MySQL的API的教程

    2024-01-25 07:51:51
  • Python采集王者最低战力信息实战示例

    2021-09-29 17:54:13
  • Python与数据库的交互问题小结

    2021-11-14 11:46:47
  • Python使用pandas处理CSV文件的实例讲解

    2021-01-31 18:23:37
  • python 实现全球IP归属地查询工具

    2023-10-05 16:31:33
  • python代码过长的换行方法

    2022-12-25 07:19:59
  • 浅谈SQL Server 对于内存的管理[图文]

    2024-01-14 07:41:44
  • asp之家 网络编程 m.aspxhome.com