使用PyInstaller打包KivyMD项目后MDFloatingActionButton禁用失效
将KivyMD项目通过PyInstaller打包为exe文件后,出现MDFloatingActionButton禁用功能失效的问题,但在未打包的Python环境中该功能可正常运行。
用于实现点击后禁用按钮的代码片段:
for btn in self.ids.values(): # Loop through all widgets in self.ids if isinstance(btn, MDFloatingActionButton) and btn != button_instance: btn.disabled = True
当前使用的环境版本:
- Python 3.9.0
- KivyMD 1.0.1
- PyInstaller 6.0.0
打包配置代码:
block_cipher = None from kivy_deps import sdl2, glew from kivymd import hooks_path as kivymd_hooks_path a = Analysis( ['Main.py'], pathex=[], binaries=[], datas=[('login.kv', '.')], hiddenimports=['kivymd.icon_definitions.icon_definitions', 'kivymd.uix.button', 'kivy.properties'], hookspath=[kivymd_hooks_path], hooksconfig={}, runtime_hooks=[], excludes=[], cipher=block_cipher, noarchive=False, optimize=0, ) pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) exe = EXE( pyz, a.scripts, a.binaries, a.zipfiles, a.datas, *[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins)], name='Main', debug=False, bootloader_ignore_signals=False, strip=False, upx=True, upx_exclude=[], runtime_tmpdir=None, console=True, disable_windowed_traceback=False, argv_emulation=False, target_arch=None, codesign_identity=None, entitlements_file=None, )
内容的提问来源于stack exchange,提问作者Shah Shah
相关产品推荐
相关产品推荐

