Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting up PySide/Qt for GUI development

I have been trying to setup PySide/Qt for use with Python3.3. I have installed

PySide-1.2.0.win32-py3.3.exe 

that I took from here and I have installed

qt-win-opensource-4.8.5-vs2010

that I took from here.

I generated .py files from .ui files (that I made using QtDesigner) using pyside-uic.exe as is explained in PySide Wiki.

Making .py files was working when I was using Qt5.1/QtCreator. I stopped using it when I found that I need to use Qt4.8 as explained on Qt-forums. With Qt4.8 it isn't working.

  • I want to develop GUI using PySide.
  • I want a drag-and-drop interface for making a skeleton GUI so I am using QtDesigner.
  • I am on Windows 7

I want to package the GUI developed into .exe files using cx-freeze.

My problem in short
What are the correct tools to use to make .ui with QtDesigner? How to convert them to .py files for use in Python using PySide?

cx_freeze is able to make my normal files to .exe Can it be used to convert the GUI made by Qt/PySide into .exe files? Would Qt be needed on other computers where the .exe of the GUI is distributed or would it be self-contained?


I used

cxfreeze testGUI.py  --include-modules=PySide

to make the exe and related files. A directory dist was created with many files. On running nothing happened. So I used command line to find out the reason. The errors are

Traceback (most recent call last):
  File "C:\Python33\lib\site-packages\cx_Freeze\initscripts\Console3.py", line 27, in <module>
    exec(code, m.__dict__)
  File "testGUI.py", line 12, in <module>
  File "C:\Python\32-bit\3.3\lib\importlib\_bootstrap.py", line 1558, in _find_and_load
  File "C:\Python\32-bit\3.3\lib\importlib\_bootstrap.py", line 1525, in _find_and_load_unlocked
  File "C:\Python33\lib\site-packages\PySide\__init__.py", line 55, in <module>
    _setupQtDirectories()
  File "C:\Python33\lib\site-packages\PySide\__init__.py", line 11, in _setupQtDirectories
    pysideDir = _utils.get_pyside_dir()
  File "C:\Python33\lib\site-packages\PySide\_utils.py", line 87, in get_pyside_dir
    return _get_win32_case_sensitive_name(os.path.abspath(os.path.dirname(__file__)))
  File "C:\Python33\lib\site-packages\PySide\_utils.py", line 83, in _get_win32_case_sensitive_name
    path = _get_win32_long_name(_get_win32_short_name(s))
  File "C:\Python33\lib\site-packages\PySide\_utils.py", line 58, in _get_win32_short_name
    raise WinError()
FileNotFoundError: [WinError 3] The system cannot find the path specified.

Anyone knows what this stacktrace means?

There is a lot of win32 in here. But I have Windows 7 64-bit. I am using 32-bit Python and all modules were installed 32-bit. Could that cause a problem? I don't think it should as other exe I made for simple Python scripts were executing fine.

like image 303
Aseem Bansal Avatar asked Dec 06 '25 19:12

Aseem Bansal


1 Answers

This error:

FileNotFoundError: [WinError 3] The system cannot find the path specified.

will be fixed in next pyside release (1.2.1). It will be released in next week.

btw: in case you don't want to generate custom bindings, you don't need to install qt, pyside installer contains all qt libraries and devel tools.

like image 74
rlacko Avatar answered Dec 08 '25 07:12

rlacko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!