Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #52918 > unrolled thread

Re: Using PyQT with QT Designer

Started byLee Harr <missive@hotmail.com>
First post2013-08-24 05:05 +0430
Last post2013-08-30 17:33 -0700
Articles 4 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  Re: Using PyQT with QT Designer Lee Harr <missive@hotmail.com> - 2013-08-24 05:05 +0430
    Re: Using PyQT with QT Designer tausciam@gmail.com - 2013-08-23 18:14 -0700
    Re: Using PyQT with QT Designer tausciam@gmail.com - 2013-08-24 14:09 -0700
    Re: Using PyQT with QT Designer tausciam@gmail.com - 2013-08-30 17:33 -0700

#52918 — Re: Using PyQT with QT Designer

FromLee Harr <missive@hotmail.com>
Date2013-08-24 05:05 +0430
SubjectRe: Using PyQT with QT Designer
Message-ID<mailman.185.1377304623.19984.python-list@python.org>
> 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. 		 	   		  

[toc] | [next] | [standalone]


#52919

Fromtausciam@gmail.com
Date2013-08-23 18:14 -0700
Message-ID<a573ea12-e2f7-4b0b-b8fe-d3575e2bab9e@googlegroups.com>
In reply to#52918
Thank you... I found my problem.... 

class MainWindow(QMainWindow, Ui_MainWindow):
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        self.setupUi(self)

That seems to take care of it... if I comment out everything else, I get my pristine form.... 

I don't know if it's the super call or the setupui....but one of those was my godsend.

So, that is solved... I just have to figure out how to put things in the gui where I want them....but I think you're right at any rate. If I try to resize, it doesn't function like I thought it would. I will have to use layouts.. but at least now I am able to use the UI file that I created.

On Friday, August 23, 2013 7:35:53 PM UTC-5, Lee Harr wrote:
> > 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.

[toc] | [prev] | [next] | [standalone]


#52949

Fromtausciam@gmail.com
Date2013-08-24 14:09 -0700
Message-ID<528c5595-4b81-45d0-8487-6ad5ae880662@googlegroups.com>
In reply to#52918
Thanks. I probably will do exactly like you suggested later on. But, those two lines have solved the problem I had and I can work on the actual program now. I can come back to the GUI later.

Here is what it looks like now: http://i.imgur.com/sLiSU6M.png

On Friday, August 23, 2013 7:35:53 PM UTC-5, Lee Harr wrote:
> > 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.

[toc] | [prev] | [next] | [standalone]


#53317

Fromtausciam@gmail.com
Date2013-08-30 17:33 -0700
Message-ID<dcb51a13-41d2-473b-b0ab-7ca6ac832177@googlegroups.com>
In reply to#52918
Lee Harr, thank you. I took your suggestion after I finished coding the audio section. You can see the improved project here: http://i.imgur.com/permuRQ.jpg

On Friday, August 23, 2013 7:35:53 PM UTC-5, Lee Harr wrote:
> > 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.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web