python 2.7 - wxPython GUI-wide settings -
i have both fundamental , technical wxpython question regarding gui settings common to, , accessed by, many aspects of single gui.
in interest of saving time haven't cut/paste huge swathes of example code explain in words. don't think lose clarity doing shout if do.
i have wxpython gui main feature notebook featuring many pages, majority of data plots. each page defined according unique class , while each class different, access same underlying data , therefore fundamentally connected. given connection, there settings within gui common pages within notebook. example, definition of colour or shape of points on various plots. such settings may used define how data displayed e.g. car data may red squares while bus data may blue triangles.
given plots on each notebook page defined in separate classes, repeat these definitions in each class. however, feels code duplication , since colour/symbol definitions should common across plots, feels these definitions should @ top gui window level not @ notebook page level.
i have tried placing attributes within top level window , can access them within notebook page class using along lines of:
self.getgrandparent(self).mysymbols
where getgrandparent crude way work hierarchy of page /notebook / panel etc main window. there may more levels traverse two.
my question is, there better way or more pythonic way define gui wide settings or attributes, once, @ top level (eg main frame) access them lower levels (eg notebook pages)?
Comments
Post a Comment