[wxPython-users] determine App instance

Christopher Barker Chris.Barker at noaa.gov
Sun Dec 16 22:12:41 PST 2007


Mark Erbaugh wrote:
> I see others have already answered your question, but here is what I am
> doing.

all good stuff, until ---


> Then in my application main file I have:
> 
> from app.view.buttonGraphics import search_img,\
>     preview_img, role_img, note_img, add_img, edit_img, delete_img,\
>     up_img, down_img

When I see and import line like that, I think -- yikes!

Remember, "Namespaces are one honking great idea. Let's do more of those!"

I much prefer something like:

from app.view import buttonGraphics

...

>         self.up_bm = wx.BitmapFromImage(buttonGraphics.up_img)

It just seems so much cleaner...

If that still feels like too much typing, you can use "import ... as" to 
give buttonGraphics a shorter name, like "BG"

-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