Pradnyesh Sawant wrote:
- i have some d'loaded python scripts (eg: memaid-pyqt), which use
"import qt". what'll happen to those scripts? how much rework (if any) is necessary to get them into working condition again?
In my experience it requires quite a bit of work - I found it easier to rewrite one of my own programs from scratch rather than modify it (the logic could be copy/pasted, but the GUI I rewrote). The changes are definitely for the better, but if you're not the original author of the code you can expect it to be quite painful to modify it to use the new version. Some of it is fairly mechanical - searching for the new location of various functions and changing calls from QPushButton() to QtGui.QPushButton() etc. Other changes are more subtle, like changes in behaviour and deprecation of some widgets.
- can you kindly provide me with some good pyqt (using qt4 designer)
tutorials? the net provides qt4 tuts but not with designer :(
I don't really use the designer myself so I haven't looked, I find it is easier to maintain code I write from scratch rather than worrying about exactly how the designer & pyuic decide to do things. As Pradeepto Bhattacharya pointed out, the Qt4 documentation and examples are helpful - assuming you're conversant with C++. There are also some useful examples of PyQt4 code at: http://indico.cern.ch/contributionDisplay.py?contribId=33&confId=44 You might also look at: http://en.wikibooks.org/wiki/PyQt4
Chirag Wazir http://chirag.freeshell.org
On 17 Dec, 03:41:27 PM, Chirag Wazir wrote:
I don't really use the designer myself so I haven't looked, I find it is easier to maintain code I write from scratch rather than worrying about exactly how the designer & pyuic decide to do things.
Thanks again for those helpful links and info
However, some Qs crop up to my mind -- plz do pardon me if i'm asking something stupid, as am a "newbie" to gui programming: why would one not use an IDE (especially one where one can drag-drop widgets onto a form) to create a gui? is it not more intuitive? is code generation not less cumbersome this way? especially with layouts; coz i just saw that qt4-designer does a very good job of laying out stuff, and that manually it would be very hard to place stuff at proper positions, and then configuring each petty detail of each widget
Thought of adding my few cents...
* I had Qt4 and python-qt4 installed in my laptop, along with qt3-designer and qt3-assistant. Am also a n00b to PyQt and Qt, just started things after foss.in 2006. As per Pradeepto's advice I am working on the Qt tutorials in the qt-assistant, where I try to write the same code in PyQt as am a bit familiar with Python.
It happened that Pradeepto looked into one of my codes and told me that I was using qt3 and pyqt3, and asked me to change to qt4 and pyqt4. The thing was, I was just working on the examples for the assistant which corresponded to Qt3. And hence i was using "import qt", and it worked fine for me. I have python-qt4 installed. Looking at the code, Pradeepto asked me to get the source and build qt4, as qt4-assistant wasn't there in the Ubuntu repos. So, yesterday I did a source build of Qt4.
* The problem I face now is, I have built the qt4 in my home directory. First, i ran make install, which created /usr/local/Trolltech/Qt4. When i tried to run assistant or designer for above path (./bin), the fonts weren't rendered properly, rather they were jagged. Then i checked the same from the place where i had built qt4, which rendered the fonts properly but the links were showing errors.
So, I removed the /usr/local/Trolltech dir and added a symlink for the qt4/docs which the assistant was looking for, in /usr/share/doc/qt4 (something like that). Now, am able to get assistant and designer fine.
But, now if i add/set the path where i built qt4, to $PATH, $QTDIR and $LD_LIBRARY_PATH, and again run assistant or designer, i get jaggered fonts in them.
I doubt that when i run it from the place where i built it, which is a folder within my HOME, then the fonts get rendered properly. But, if i set the PATHs as stated above and try to run it, then the fonts are disfigured. Is this anyway concerned with the locale settings ? Where am I going wrong ? Any idea ?
Hi
On 12/17/06, Pradnyesh Sawant pradnyesh@iitg.ernet.in wrote:
On 17 Dec, 03:41:27 PM, Chirag Wazir wrote:
I don't really use the designer myself so I haven't looked, I find it is easier to maintain code I write from scratch rather than worrying about exactly how the designer & pyuic decide to do things.
Thanks again for those helpful links and info
However, some Qs crop up to my mind -- plz do pardon me if i'm asking something stupid, as am a "newbie" to gui programming: why would one not use an IDE (especially one where one can drag-drop widgets onto a form) to create a gui? is it not more intuitive? is code generation not less cumbersome this way? especially with layouts; coz i just saw that qt4-designer does a very good job of laying out stuff, and that manually it would be very hard to place stuff at proper positions, and then configuring each petty detail of each widget
Umm, I am guessing you misunderstood my line. I did say use the Qt Designer which is not an IDE, its a WYSIWIG tool to design UIs. Please use it by all means as much as you want. And for doing that the Qt Designer manual is something I told you to refer. The point where you have to change your path from a person doing it in C++ is use "pyuic" instead of using "uic". Designer doesnot give any C++ or Py code, it churns out XML which is converted into C++ or Py by uic or pyuic respecitively.
So in short : to learn Qt4 designer please the Qt4 docs that come with the source or assistant. But use pyuic. And I say that because you wanted an PyQt tutorial for designer. The designer part always remains the same.
Cheers!
Pradeepto
On 17/12/06 16:37 +0530, Pradnyesh Sawant wrote:
On 17 Dec, 03:41:27 PM, Chirag Wazir wrote:
I don't really use the designer myself so I haven't looked, I find it is easier to maintain code I write from scratch rather than worrying about exactly how the designer & pyuic decide to do things.
Thanks again for those helpful links and info
However, some Qs crop up to my mind -- plz do pardon me if i'm asking something stupid, as am a "newbie" to gui programming: why would one not use an IDE (especially one where one can drag-drop widgets onto a form) to create a gui? is it not more intuitive? is code
Because sometimes it is just easier to write source directly. Not always, just sometimes. Intuitive, yes, but setting properties is just easier in the editor.
generation not less cumbersome this way? especially with layouts; coz i just saw
Layouts are best done in a visual medium, properties are not necessarily best done that way. Code generation isn't necessarily a good idea either, often the programmer can do a better job.
For a newbie, I would recommend the use of the designer tool and automagic code generation, until you learn what the code generator does.
Devdas Bhagat