HtmlWindow Gradient Background?

I have been trying to get a gradient background in an htmlWindow.
Since the <body bg...> tag the window uses does not support gradients,
I was trying to find another way.

Tried setting the background of the htmlWindow transparent (using an
alpha, wx.Colour(255, 255, 255, 0 ) and placing the gradient on a
panel underneath to no avail.

Tried the same on the main html containerCell
(GetInternalRepresentation()), without success.

Tried various combinations of SetTransparent(0) frame style
wxTRANSPARENT_WINDOW also.

Is there a way to do this or will htmlWindow not allow a transparent
background?

···

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

I have been trying to get a gradient background in an htmlWindow.
Since the<body bg...> tag the window uses does not support gradients,
I was trying to find another way.

Tried setting the background of the htmlWindow transparent (using an
alpha, wx.Colour(255, 255, 255, 0 ) and placing the gradient on a
panel underneath to no avail.

The HtmlWindow classes use wx.DC for drawing, which has very limited support for alpha (drawing images only).

Tried the same on the main html containerCell
(GetInternalRepresentation()), without success.

Tried various combinations of SetTransparent(0) frame style
wxTRANSPARENT_WINDOW also.

Is there a way to do this or will htmlWindow not allow a transparent
background?

Not that I know of.

···

On 5/21/10 3:09 PM, tsmorton wrote:

--
Robin Dunn
Software Craftsman

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

Not that I know of.

Thanks, Robin, I was hoping that wasn't the case.

By the way, I have seen in a couple places that htmlWindows can accept
background images. What is the tag used for that? I tried the standard
html tag (<body background="bgimage.jpg">) but it doesn't work. Also,
do the images tile? If so, I may be able to make a gradient BG image.

Tim

···

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

My oversight. background images do work and tile. I had the image name
wrong in the tag.

Thanks,
Tim

···

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

Thank you Ray and Robin,

I have found a way to make a popup window with a gradient background,
though it is a bit of a kludge.

I tried over-riding the OnPaint method of htmlWindow without success
so I tried a 1x100 pixel gradient as a background image letting it
tile. The issue with this is the background image height must match
the height of the window or it will tile again showing "seams." The
only way I could come up with to resolve this is use a MemoryFShandler
and resize the image to the window height.

        bgImg = wx.Image('blueBack.png', wx.BITMAP_TYPE_ANY)
        self.demoWindow.SetPage(t)
        ir = self.demoWindow.GetInternalRepresentation()
        self.demoWindow.SetSize( (ir.GetWidth(), ir.GetHeight()) )
        self.SetClientSize(self.demoWindow.GetSize())

        bgImg.Rescale(1, ir.GetHeight())

        memFs = wx.MemoryFSHandler()
        wx.FileSystem_AddHandler(memFs)

        memFs.AddFile('bg.png', bgImg, wx.BITMAP_TYPE_PNG)
        self.demoWindow.SetPage(t)

        memFs.RemoveFile('bg.png')

The SetPage must be called twice, once to determine the size of the
htmlWindow and the second time to add the sized gradient (1 pix wide x
window height).

"<body background="memory:bg.png">" must be used in the html text.

This works good, but there may be a better way.

Here is an image, http://www.BibleAnalyzer.com/files/htmlPopup.jpg

My two cents:
htmlWindow is a very useful control in wxPython but it seems it
receives little attention and improvement from the wx developers. I
even made a suggestion on the wxDev board a year or so ago (desiring
the ability to highlight word cells and/or selections. Container cells
[a whole line] can have their background color changed, but not single
word cells) but just got my hands slapped for wanting and doing
something that is "unsupported" (I kludged up a way to highlight a
line of html on a click that works very well in my app.) I thought one
of the main tenants of programming was innovation and adaptation to
make something new. Oh well.

If anyone wants the code to make an html popup window w/gradient, let
me know and I'll put it up when I get time.

Thanks again, to all.
Tim

tsmorton wrote:

even made a suggestion on the wxDev board a year or so ago (desiring
the ability to highlight word cells and/or selections. Container cells
[a whole line] can have their background color changed, but not single
word cells) but just got my hands slapped for wanting and doing
something that is "unsupported"

well, were you offering to code up a patch? I think you are right, that htmlwindow doesn't get much attention, but there is SO much you could want to add to it, there may be resistance to adding one or two special features.

I have hopes for wxWebKit, though -- it's looking promising.

If anyone wants the code to make an html popup window w/gradient, let
me know and I'll put it up when I get time.

Please put it on the Wiki -- it's pretty cool, and I think instructive for other uses, as well.

-Chris

···

--
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

Chris,

I have hopes for wxWebKit, though -- it's looking promising.

Yes, it does. I hope they get the size down, though. A 48MB dll is a
bit much!

Please put it on the Wiki -- it's pretty cool, and I think instructive
for other uses, as well.

Ok, when I get time I'll put it on.

Thanks,
Tim

Hi Tim,

Chris,

I have hopes for wxWebKit, though -- it's looking promising.

Yes, it does. I hope they get the size down, though. A 48MB dll is a
bit much!

It's a debug build, since these are not official releases. I'm just packing up the latest debug build I've done. I've just done a release build to check and libwxwebkit.dll comes in at about 8.4MB + deps, which come to about 25 MB total. It's a lot, but last I checked it was about half the size of the Mozilla runtime. It could probably also be trimmed further if someone was able to get WebKit to statically link against ICU.

Regards,

Kevin

···

On May 26, 2010, at 7:05 PM, tsmorton wrote:

Please put it on the Wiki -- it's pretty cool, and I think instructive
for other uses, as well.

Ok, when I get time I'll put it on.

Thanks,
Tim

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

Hi Kevin,

Thanks for the news about wxWebKit. 8.4MB sounds much better than
48MB. I'm looking forward to trying it out. It looks like it will be a
great asset to wx.

Tim