-backslashes are not necesseary when you declare list or dict on many lines.
I didn't pay attention at the semantic of your code, but after giving a quick look, you can simplify things like:
BRUSHSTYLENAMES = ['Transparent', 'Solid', 'BDiagonalHatch', 'CrossDiagHatch', \
'FDiagonalHatch', 'CrossHatch', 'HorizontalHatch', 'VerticalHatch' ]
BSTYLES = { BRUSHSTYLENAMES[0]: wxTRANSPARENT, \
BRUSHSTYLENAMES[1]: wxSOLID, \
BRUSHSTYLENAMES[2]: wxBDIAGONAL_HATCH, \
BRUSHSTYLENAMES[3]: wxCROSSDIAG_HATCH, \
BRUSHSTYLENAMES[4]: wxFDIAGONAL_HATCH, \
BRUSHSTYLENAMES[5]: wxCROSS_HATCH, \
BRUSHSTYLENAMES[6]: wxHORIZONTAL_HATCH, \
BRUSHSTYLENAMES[7]: wxVERTICAL_HATCH }
BRUSHSTYLES = [ wxTRANSPARENT, wxSOLID, wxBDIAGONAL_HATCH, wxCROSSDIAG_HATCH, \
wxFDIAGONAL_HATCH, wxCROSS_HATCH, wxHORIZONTAL_HATCH, wxVERTICAL_HATCH ]
By writing something like :
BRUSHSTYLENAMES = ['Transparent', 'Solid', 'BDiagonalHatch', 'CrossDiagHatch',Or by declaring the dict BSTYLES first and then doing "BRUSHSTYLENAMES, BRUSHSTYLES=BSTYLES.items()"
'FDiagonalHatch', 'CrossHatch', 'HorizontalHatch', 'VerticalHatch' ]
BRUSHSTYLES = [ wxTRANSPARENT, wxSOLID, wxBDIAGONAL_HATCH, wxCROSSDIAG_HATCH,
wxFDIAGONAL_HATCH, wxCROSS_HATCH, wxHORIZONTAL_HATCH, wxVERTICAL_HATCH ]
BSTYLES = dict(zip(BRUSHSTYLENAMES, BRUSHSTYLES))
(In this case, the lists will not be ordered)
Moreover, wxPython should be better called wx.Python now. ;-)
You shouldn't use:
and then calling wx.Brush instead of wxBrush, wx.SOLID instead of wxSOLID, etcMoreover, wxPython should be better called wx.Python now. ;-)
You shouldn't use:
from wxPython.wx import *But
import wx
Except these little things, if your code works, it's perfect!
I told you these advises to improve your way of coding in Python ;-)
Cyril
-- http://mail.python.org/mailman/listinfo/python-list