wx.html.HtmlWindow transparent background?

Is is possible to make the background of wx.html.HtmlWindow
transparent?

What I mean is this:

* create a custom widget that draws its background
* place one or more wx.html.HtmlWindow widgets on it
* instead of the html body background color, the parent's custom
background should appear.

Is this possible?

   L

No. You could do the background drawing to a bitmap, save the bitmap to a file, and then have the html document use that image file as its background. There is also a way to do it all in memory, but that is more complex. Search for examples using wx.MemoryFileSystem.

···

On 9/13/11 1:00 PM, nagylzs wrote:

Is is possible to make the background of wx.html.HtmlWindow
transparent?

What I mean is this:

* create a custom widget that draws its background
* place one or more wx.html.HtmlWindow widgets on it
* instead of the html body background color, the parent's custom
background should appear.

Is this possible?

--
Robin Dunn
Software Craftsman

> Is this possible?

No. You could do the background drawing to a bitmap, save the bitmap to
a file, and then have the html document use that image file as its
background. There is also a way to do it all in memory, but that is
more complex. Search for examples using wx.MemoryFileSystem.

Almost there. Everything is prepared, I have a background wx.Bitmap
created. But I don't know how to use wx.MemoryFileSystem. :frowning: I was
google-ing for 5 minutes, but still cannot find any example with
wx.MemoryFileSystem. I went through my whole site-packages dir
searching for files containing wx.MemoryFileSystem, but there was
nothing. Can you please point me to the right direction?

Thanks,

   Laszlo

Sure, here is a simple example of how to do it.

-Chris

NOTE: I really need to find place to post all these little examples I have....

ImageInHtml.py (10 KB)

···

On 9/17/11 12:21 AM, nagylzs wrote:

Almost there. Everything is prepared, I have a background wx.Bitmap
created. But I don't know how to use wx.MemoryFileSystem. :frowning: I was
google-ing for 5 minutes, but still cannot find any example with
wx.MemoryFileSystem. I went through my whole site-packages dir
searching for files containing wx.MemoryFileSystem, but there was
nothing. Can you please point me to the right direction?

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

A bit of a problem in the example:

EXCEPTION: ImportError: No module named ImageInHtml

---- Statement mod = import(name)
Line # 233
Function _my_import
File wxpTag.py
File Path C:\PROGRA~2\Python26\lib\SITE-P~1\WX-2~1.8-M\wx\lib\

---- Statement self.ctx.classMod = _my_import(modName)
Line # 133
Function HandleWxpTag
File wxpTag.py
File Path C:\PROGRA~2\Python26\lib\SITE-P~1\WX-2~1.8-M\wx\lib\

---- Statement return self.HandleWxpTag(tag)
Line # 117
Function HandleTag
File wxpTag.py
File Path C:\PROGRA~2\Python26\lib\SITE-P~1\WX-2~1.8-M\wx\lib\

A bit of a problem in the example:

#### EXCEPTION: ImportError: No module named ImageInHtml

It works for me -- how are you running it? I ran it from the command line, in the dir where ImageInHtmp.py is.

The trick is that to embed a wx.StaticBitmap in wxHTML, you need to specify the module that it is defined in , and that module needs to be on sys.path.

Anyway, that's for the wx.StaticBitmap demo, you can comment that out and still use the Virtual File system method.

-Chris

···

On 9/17/11 10:16 AM, Ray Pasco wrote:

---- Statement mod = __import__(name)
Line # 233
Function _my_import
File wxpTag.py
File Path C:\PROGRA~2\Python26\lib\SITE-P~1\WX-2~1.8-M\wx\lib\

---- Statement self.ctx.classMod = _my_import(modName)
Line # 133
Function HandleWxpTag
File wxpTag.py
File Path C:\PROGRA~2\Python26\lib\SITE-P~1\WX-2~1.8-M\wx\lib\

---- Statement return self.HandleWxpTag(tag)
Line # 117
Function HandleTag
File wxpTag.py
File Path C:\PROGRA~2\Python26\lib\SITE-P~1\WX-2~1.8-M\wx\lib\

--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

I also got the ImportError, but after commenting out that tag,
everything works fine.

I was looking for wx.MemoryFileSystem, but now I see that the correct
class is wx.MemoryFSHandler.

Thank you for your help!

   L

A bit of a problem in the example:

#### EXCEPTION: ImportError: No module named ImageInHtml

It works for me -- how are you running it? I ran it from the command
line, in the dir where ImageInHtmp.py is.

The trick is that to embed a wx.StaticBitmap in wxHTML, you need to
specify the module that it is defined in , and that module needs to be
on sys.path.

Yep, this problem can happen sometimes if the sys.path or the cwd is not right when you are using a class from the wxp tag that is in the same module being run as the main script. If another module is the main script and the one with the class being used from <wxp> is imported normally (IOW, just like any normal program that is larger than a simple sample) then this problem will not show up at all.

Anyway, that's for the wx.StaticBitmap demo, you can comment that out
and still use the Virtual File system method.

Indeed.

···

On 9/17/11 10:27 AM, Chris Barker wrote:

On 9/17/11 10:16 AM, Ray Pasco wrote:

--
Robin Dunn
Software Craftsman

Thanks, Chris. And, may the lawn gnome gods be with you.

Ray