Gabor Szabo <szab...@gmail.com> writes: > Wouldn't it be better to have a clear separation in your code > between things not using Wx that can be run without any piece of Wx > and the GUI part that is Wx based?
Actually, the separation between GUI and execution code is quite clear, otherwise this wouldn't have been possible at all. The dialog has a (wxGlade generated) constructor that sets up all GUI related components (dialog, sizers, widgets). I don't call it. An 'init' method transfers external data to some of the widgets. I provide stubs for these widgets so the data gets stored in a safe place. The 'OnExecute' method transfers data from the widgets (the stubs use the aforementioned safe places) and starts the real work. Upon completion, some data is transferred to some widgets. The 'real work' is non-GUI except for a ProgressBar and possible notifications. For complete separation the 'real work' method would get all data through parameters and return results via one of the several mechanisms that Perl provides. No big deal. Also, for the ProgressBar (and notifications) a formal call-back mechanism could be used. The final question would be whether that would be worth the trouble. In this case I doubt it. YMMV. But is *is* an interesting how many (or few) lines of code it takes to run a rather arbitrary dialog stand-alone... In this particular case, it took less than 50 lines. -- Johan