[wxPython-users] determine App instance

Christopher Barker Chris.Barker at noaa.gov
Tue Dec 18 20:57:41 PST 2007


Mark Erbaugh wrote:
> # file app.view.main_app.py
> 
> import wx
> from app.view.buttonGraphics import search_img, ...

> With this approach, aren't search_img, etc just imported into the
> app.view.main_app namespace?

yes. There really aren't truly global variables in Python the way there 
are in other languages -- and that's a good thing!

Even if it just for that module -- I still feel like it's kind of ugly 
-- and you now have to change code in two places if you add new bitmap 
-- once in your code where you use it, and once in the import statement.

Also, in the code itself it's not obvious where that variable came from.

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

NOAA/OR&R/HAZMAT         (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception




More information about the wxpython-users mailing list