Using PyQT with QT Designer
tausciam at gmail.com
tausciam at gmail.com
Fri Aug 23 21:14:07 EDT 2013
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.
More information about the Python-list
mailing list