Using PyQT with QT Designer

Lee Harr missive at hotmail.com
Fri Aug 23 20:35:53 EDT 2013


> That's the problem though. It is exactly how I want it in designer. It's
> perfect as it is in designer when I preview it. Here is a screenshot of the
> preview: http://i.imgur.com/ULRolq8.png

That's not a preview. That's just the regular design view.
(you can tell by the little dots in the background)

You need to go to Form -> Preview... to see the actual preview.

That said...

1.) You may want to ask your question on the PyQt mailing list. Though
you are talking with the undisputed PyQt expert in Phil, there are more
people on the other list who are familiar with PyQt and who may be willing
to look more closely at your specific code.

2.) It may be that the examples you are looking at are not sufficient to
help you with the situation you are in. For instance, I've written several
programs using Designer and PyQt and I would recommend against
using the pyuic method.

When I first started with PyQt I also used pyuic and eventually I found
the PyQt4.uic method works better for me.

3.) Layouts. You have to use them with Qt or you're going to have a
bad time.

Looking at your design, I would do something like ...

- select the two buttons on the left and click "Lay Out Vertically"
- select the two large white boxes and click "Lay Out Vertically"
- put a vertical spacer underneath the red X button
- select the red button and the spacer and click "Lay Out Vertically"
- at this point you may need to resize and rearrange your three vertical
   layouts so that they don't overlap and are in approximately the positions
   that you want, then
- select the main window and click "Lay Out Horizontally"

Something along those lines would get you about to where you want
to be. The form may not look _exactly_ the way you have it there, but
it will be a more flexible design and nothing will be overlapping. 		 	   		  


More information about the Python-list mailing list