Best Practice
Prev | Chapter 2. Exploring wxGlade | Next

## Best Practice

The main goal of the recommendations is to improve the usability and maintainability of code generated by wxGlade. The recommendations combine the experience of many wxGlade users.

Always overwrite existing sources

  wxGlade is able to adapt existing source files after the design has changed. This feature have some limitations e.g. in case of name changes and changed dependencies. Thereby it’s recommended to overwrite existing sources always and extend derived classes with your functionality.

Use new namespace for Python projects

  It’s generally recommended to use the new namespace (“import wx”) for wxPython projects. The old one (“from wxPython.wx import *”) has some significant drawbacks like potential namespace conflicts.

Use the C++ naming convention

  Use the C++ names for all wx identifies like classes, colours or events of the wx framework. Please don’t enter identifiers already formatted in a language specific form. wxGlade is able to transform the entered original identifiers in language-specific terms. You can use your own style for your object certainly.

  Example 2.1. Correct entered wx constant

  Enter “wxID_CANCEL” even for wxPython instead of “wx.ID_CANCEL”

Always use UTF-8 encoding

  It's generally recommended to use Unicode encoding for all non-ASCII character sets.

Always use gettext support

  Enable internationalisation support. There are no disadvantages if internationalization is active but not used.

  It's hard to add i18n and Unicode afterwards from project point of view.

Suggestion on naming

  The wxWidgets are written in C++ and follow the C++ naming convention. This naming convention may differ from the language specific and / or project specific naming convention.

  For consistency's sake, it's recommended to use the wxWidgets style.

Prev | Up | Next
Basics of wxGlade | Home | Command line invocation