PDA

View Full Version : Newbie question regarding Py Qt4 Designer



dennisvz
24th January 2017, 21:54
As a newbie (this is my first post here), I am six months into Python and about a month into Qt4 Designer (I know Excel userforms, which seems to be close to the Qt Designer). Here are my questions:

1. Regarding "layouts - horizontal, vertical, etc" -- is the only benefit to using one of the layouts is that the form/GUI will resize proportionately? If I design one that fits on a laptop and/or desktop, does it matter if the user can resize the form? Is there a trick to picking a layout for a non-linear form -- like one that has 9 frames of different sizes -- I have tried hundreds of times, but the frames (and labels, etc) keep jumping all over the page once I hit one of the layouts. I have read the literature, but just cannot seem to get it.

2. When I completed my GUI (without a layout), I clicked to view the code, and received this error message "Unable to launch C:Python34/lib/site-packages/PyQt4\uic". I have Python 3.6 installed, but I do not know what this message means.

3. I use PyCharm as my IDE and have written a program in it. Once I figure out question #2, how do I get the GUI code into my PyCharm file, or how do I get my PyCharm file into the GUI? Or is there another way to link them together?

Thanks for responding

anda_skoa
25th January 2017, 09:54
1. Regarding "layouts - horizontal, vertical, etc" -- is the only benefit to using one of the layouts is that the form/GUI will resize proportionately?

The main benefits of layout is that you get stable arrangements.
Space requirements of UI elements can change, e.g. due to different font or font sizes, language, etc.

Layouts make sure that elements are resized and repositioned as needed.



If I design one that fits on a laptop and/or desktop, does it matter if the user can resize the form? Is there a trick to picking a layout for a non-linear form -- like one that has 9 frames of different sizes -- I have tried hundreds of times, but the frames (and labels, etc) keep jumping all over the page once I hit one of the layouts. I have read the literature, but just cannot seem to get it.

The usual workflow is to layout items together that belong together, by selecting them and then selecting the approriate layout.
A container widget's main layout is then often just a vertical or horizontal arrangement of these sub layouts.



2. When I completed my GUI (without a layout), I clicked to view the code, and received this error message "Unable to launch C:Python34/lib/site-packages/PyQt4\uic". I have Python 3.6 installed, but I do not know what this message means.

The UIC is a tool from Qt in your case PyQt. I generates code from the XML document that QtDesigner saves to.
Check the path, see if the executable is there.



3. I use PyCharm as my IDE and have written a program in it. Once I figure out question #2, how do I get the GUI code into my PyCharm file, or how do I get my PyCharm file into the GUI? Or is there another way to link them together?


There are different approaches.
Usually the class generated by uic is imported and then used inside a user defined class, but is is also possible to derive from the generated class.

Cheers,
_

dennisvz
28th January 2017, 17:47
Regarding the answer to my #2 question, how do I check the path? What should it be? I am a beginner and do not know how to do the path thing.

anda_skoa
30th January 2017, 09:27
Regarding the answer to my #2 question, how do I check the path? What should it be? I am a beginner and do not know how to do the path thing.

For a programmer it is essential to know the basics of how operating systems work, specially the one the programmer works with.

https://en.wikipedia.org/wiki/Path_(computing)

The error you got and which you posted in the first comment of this thread complains that a program at a certain path can't be launched.
The first thing to do is therefore to check if that program is actually at that path.

Cheers,
_