Using QTDesigner with PyQT and Python 2.6
Posted
by PyNewbie27
on Stack Overflow
See other posts from Stack Overflow
or by PyNewbie27
Published on 2010-03-22T02:08:09Z
Indexed on
2010/03/22
2:11 UTC
Read the original article
Hit count: 989
Hi. I'm fairly new to Python and trying to work with the latest versions of QTDesigner, PyQT 4.7 and QT4.7 (I downloaded the whole package from PyQT4.7 website).
I can't figure out how to make QTDesigner integrate closely with Python:
ie. If I select "Form" > View Code in QTDesigners menu, it errors saying "Unable to launch C:/Python26/Lib/site-packages/PyQT4/bin\uic." If I look in that directory there is a pyuic.py but not "uic". From searching online it seems this doesn't exist because it's expecting a C++ install instead of the python version.
Is there anyway to make QTDesigner use/call pyuic.py to generate the code, then open an IDE or text editor of my choice to show me the PYTHON code generated by the QTDesigner->PyUIC chain?
I'd like Designer to integrate closely with python, so I can make custom slots/signals in Designer while designing, then tweak the python code directly in my IDE later.
If it is not possible to code directly inside QTDesigner using python, does that mean I have to hand code my programs entire UI directly in my PythonIDE? Using Designer directly would seemingly be nearly very very nice for a newbie such as myself, since I can see what properties each widget has and visually edit them while still learning the QT syntax without constantly having to use web resources to see what properties each widget should have and helps with boilerplate code generation, and what their defaults are, etc.
I've googled and nobody seems to be using QTDesigner and Python in this manner together. It seems most are either handcoding all the QT code in their Python IDE of choice, or have found an obvious/easy method of doing what I want, therefore not really producing up to date tutorials on making this work together.
Please enlighten me if you can. Thanks in advance for your time. Please include any suggestions you might have to a newbie trying to use Python with QT and QTDesigner.
Thank you.
© Stack Overflow or respective owner