I come from a Structured Programming background, and I fall back to old habits sometimes, because they were efficient in their context. But I'm trying to find context here.
In my last environment (Superbase), which was a mess in some ways, I had the flexibility to encapsulate code in OO constructs, or simply to drop oft-used chunks into subroutines, which had NO scope restrictions, and could be loaded on demand.
What I'm trying to do today is to better understand the wx.lib.printout collection in wxPython by wrapping convenient parts like basic setup, final print, etc. in simple -- really simple -- function calls.
The problem with scoped functions is that I have to place all those setup variables (PrintBase, PrintGrid, PrintTable, etc.) in my main app prior to calling the routines. I don't want to do that for two reasons: It stinks of cut-and-paste activity, and it's inelegant.
In this case, it's a couple lines of code, and no biggie, so consider it an academic exercise. To use the full functionality of this module, it's not so trivial, and consumes tons of whitespace in a language that doesn't tend to go that way. The last thing I'd prefer not to do, because all my sloppy VB buddies used to do it, is declare everything global just to get the job done.
So at the core, I would like to have simple, callable functions that initiate wx.lib.printout parameters at the beginning of my main calling app that can be later referenced by the wrap-up printing routines without declaring stuff all over the place.
Can it be done?
Seeya,
In my last environment (Superbase), which was a mess in some ways, I had the flexibility to encapsulate code in OO constructs, or simply to drop oft-used chunks into subroutines, which had NO scope restrictions, and could be loaded on demand.
What I'm trying to do today is to better understand the wx.lib.printout collection in wxPython by wrapping convenient parts like basic setup, final print, etc. in simple -- really simple -- function calls.
The problem with scoped functions is that I have to place all those setup variables (PrintBase, PrintGrid, PrintTable, etc.) in my main app prior to calling the routines. I don't want to do that for two reasons: It stinks of cut-and-paste activity, and it's inelegant.
In this case, it's a couple lines of code, and no biggie, so consider it an academic exercise. To use the full functionality of this module, it's not so trivial, and consumes tons of whitespace in a language that doesn't tend to go that way. The last thing I'd prefer not to do, because all my sloppy VB buddies used to do it, is declare everything global just to get the job done.
So at the core, I would like to have simple, callable functions that initiate wx.lib.printout parameters at the beginning of my main calling app that can be later referenced by the wrap-up printing routines without declaring stuff all over the place.
Can it be done?
Seeya,
Comment