Работа с графическим интерфейсом на Python (3.6.5 на win32), PyQt5 (5.10.1), использование cx_Freeze (5.1.1).
Есть функция для использования принтеров.py:
def goPrinter(self):
print("___goPrinter")
printer = QtPrintSupport.QPrinter()
print(printer)
print(printer.printerName())
print(QtPrintSupport.QPrinterInfo.availablePrinterNames())
print("return")
Когда я запускаю py - скрипт, принтер работает нормально.
cmd:
-__ goPrinter
-PyQt5.QtPrintSupport.QPrinter объект в 0x02FF1EBO>
-Microsoft XPS Document Writer
- ['Microsoft XPS Document Writer', 'FAX']
-return
Когда я запускаю файл exe (после cx-Freeze), все принтеры невидимы.Печать не работает.
cmd:
-__ goPrinter
-PyQt5.QtPrintSupport.QPrinter объект в 0x02BB23B0>
-
- []
- возврат
setup.py скрипт для создания exe:
from cx_Freeze import setup, Executable
executables = [Executable('KIWI_1105.py',
targetName='KIWIv17.exe',
icon='iconsN\capsule.ico',
shortcutName='KIWI',
shortcutDir='DesktopFolder'
)]
excludes = ['email', 'http', 'urllib', 'unittest']
zip_include_packages = ['collections','distutils', 'encodings',
'importlib', 'logging', 'imageformats',
'platforms', 'PIL', 'pydoc_data', 'PyQt5', 'xml']
include_files = ['iconsN', 'Atlas']
options = {
'build_exe': {
'excludes': excludes,
'zip_include_packages': zip_include_packages,
'include_files': include_files,
'include_msvcr': True,
'build_exe': 'KIWI',
}
}
setup(name='KIWI App',
author='23',
version='17.1505',
description='KIWI Viewer Application',
executables=executables,
options=options)