Introduction

The idea behind this page is that there are some things that are not really specific to any application or operating system, but help in making wxPython programs more portable. Hopefully more people will add to this page to make it more comprehensive.

Using Sizers

Sizers are incredibly important to making cross platform applications, since they 'decide' how to display the various parts of the GUI. For example, one problem which can arise is the default size of buttons being different from platform to platform. Let's say your application doesn't use sizers, and you specify the main frame to be X pixels wide, then add a row of buttons somewhere, and it looks fine on the platform you are developing in. Take the same code to another platform, and the last button of said row is now partly off the frame and unreadable! If you use sizers, then the main frame of the application will be resized so that everything fits - regardless of platform. In fact when using sizers, there is no need to specify the size of the main frame, leave out the size parameter in the wx.Frame constructor

- brief sizer example will go here -

Specifying Text Size and Font

By specifying a certain font and its size in the topmost frame class (so that all child classes inherit it), several things are accomplished. First, your application will have a similar look across platforms. Secondly, for certain things the text size obviously heavily influences the size of the widget - buttons, dropdown boxes, et cetera. By not allowing the operating system to use its default font and size, in certain circumstances it is entirely possible to define a set size for, say a button, and not have the text go off the button face if the default system font is larger than the default system font you are developing in (I noticed this problem when going from winXP to KDE). This is usefull if you need to make a widget smaller than its default size, like when trying to cram a bunch of stuff into a small frame.

- brief example goes here -

Comments

Please add to this page!

Some General Cross Platform Guidelines (last edited 2009-05-28 04:57:52 by 79-73-238-161)

NOTE: To edit pages in this wiki you must be a member of the TrustedEditorsGroup.