Re: wxglade is not preserving my code after a regen

Johan Vromans <[email protected]> Wed, 28 Apr 2021 08:15:48 +0200
Newsgroups gmane.comp.python.wxglade
Organization Squirrel Consultancy
Message-ID <[email protected]>
On Tue, 27 Apr 2021 14:25:57 -0700, William Luitje wrote:

> Thank you for the derived class suggestion. I will try that in my next
> small project.

IMHO the 'derived class' approach should be preferred in practically all
cases. It is much cleaner (and safer) to have file-based separation of
your own code, and the generated code.

For example, when using a version control system (we all do, don't we?) you
only need to check in your own code and the .wxg files and leave the
generated files out.

For my perl applications I have adopted a convention as follows:

MyApp/PreferencesDialog.pm        the user code
MyApp/PreferencesDialog_wxg.wxg   the wxGlade data
MyApp/PreferencesDialog_wxg.pm    the wxGlade generated file

In MyApp/PreferencesDialog.pm:

   package MyApp::PreferencesDialog;
   use parent MyApp::PreferencesDialog_wxg;

Other conventions are possible. This one just stuck :) .

-- Johan