Images and preview

Johan Vromans <[email protected]> Thu, 5 Sep 2024 14:05:51 +0200
Newsgroups gmane.comp.python.wxglade
Organization Squirrel Consultancy
Message-ID <[email protected]>
Assume a bitmap widget (but this applies to all images).

In the properties pane I can enter the name of an image file. This is ok,
but for a short time only. The application will be packaged and
distributed, and the images need to be located otherwise.

Fortunately, wxGlade provides the neccessary code extensions. Instead of
a hard-coded bitmap path I can use `var:...` to designate a variable that
holds the filename of the image, and with Code > Insert before I can call a
function to retrieve the image file name and fill the variable. Perfect.

Except that I no longer can use the wxGlade 'preview'...

An inelegant workaround would be the possibility to define `var:...`
(for the generated code) **and** a static file name for preview. But maybe
there are better solutions?

In the past I used to overrule Wx::Bitmap::new with custom code, but that's
also not really elegant.

Thoughts?

-- Johan