Here are just some random notes about WxPython.
| Table of contents [hide] |
Setup is done using the wx.Locale class :
>>> import wx
>>> locale = wx.Locale()
>>> locale.Init2()
True
>>> wx.GetTranslation("Close")
u'Fermer'
>>> wx.GetTranslation("Cancel")
u'Annuler'
>>> wx.GetTranslation("File")
u'File'
>>>
wxPython comes with a catalog for built-in controls and dialogs. It is automatically loaded by wx.Locale.
XrcResourceFiles are also compatible with localization. Strings in XRC files are automatically passed to the translation mechanism.
To add a catalog, use locale.AddCatalog and optionally locale.AddCatalogPathPrefix.
Calling window.SetSizeHintsSz(window.GetBestSize()) on every window is a good idea: it will prevent resizing to sizes too small.
A FlexGridSizer as root element of a window or dialog allows to have autogrowable rows or columns, so that the window contents don't stay small if the user enlarges the window. For inner controls, use the wxEXPAND (or wxGROW) flag so that they follow suit when the containing window is resized. The "ratio" parameter controls relative sizing of elements in a sizer.
The various wx Sleep functions (wx.MilliSleep, etc.) look like they completely invalidate the normal event loop behaviour, e.g. all idle events are suspended. Thus they must be avoided.
The following tools are useful:
See this example !