tags:

views:

41

answers:

1

PyQt experts: I developed the GUI in Windows and used setGeometry to position the widgets. When I tried to run the same code in Linux it looks cluttered.

And added to that in Windows the font size of 8 seems good. But in Linux, especially in Ubuntu, it doesn't appear well since the font size is 10 by default. Some among the differences are the border of the group box doesn't appear in Linux while it is visible in Windows..

Is there a way that I can make the same code to get the same look and feel in Windows and Linux irrespective of the font and size changes and other differences?

In future if I port my application to Mac will the same code work there too? Or should I have to maintain the separate code for each by checking with platform.system() equal to "windows" or "linux"?

A: 

The answer is simple: don't use setGeometry directly (to position your widgets).

Consider the following: what if the user wants to resize your application window?

Compose the user interface (you could do this from Designer or from code) within QSplitters (if you want a resize handle between two components) and/or within QVBoxLayouts / QHBoxLayouts (note that these can be nested).

This will make your UI components behave consistently.

ChristopheD
Thanks christo for your reply.. But we can't have the spacing between the widgets as desired.. In some areas I've had to use overlapped borders to achieve the desired effects.. Even if we set the spacing to 0 we cant achieve customisation to that much.. Is there any other way of doing that??
Jebagnanadas