wx.html.HtmlWindow scaling page

I am using the wx.html.HtmlWindow widget for the first time. I’m a novice with HTML(5) as well.

I have a problem with scaling the webpage to fit within the initial size of the html widget.

I have a frame with several panels. The frame is about 1/3 the screen size by default, although it can expand. One panel has a vanilla wx.html.HtmlWindow widget as it’s only control. This panel takes about 1/3 of the frame’s default size. The other panels stay basically the same size when the frame expands; ie primarily the WebNews panel expands. The html window shows a small webpage (by design) of news. However this webpage my not be exactly 300 by 300 pixels on any give day. It might vary by ± 5% in size on either axis. Exact aspect ratio of the webpage is of little concern. All is good so far.

The problem I have is knowing how to scale the webpage to scale up or down to fit within the wx.html.HtmlWindow’s initial size of 300 x 300. I’d like to see no border, margin or outline around the mini-webpage.

With news = wx.html.HtmlWindow(self, size=(300,300)) additionally I need to use new.SetBorders(0). However this only removes the top and left borders from around the webpage content. There is some kind of margin, border, outline or something that allows the left and bottom parts of the underlying panel to be seen. I’d like to have the webpage take up the entire panels size. This could be some HTML tag default behavior for all I know.

As a simple test case I am using the following HTML:

Although adding width and height attributes to the tag scales the image; it’s the tag that I’d like to scale; for when there is more then just an image. I’ve tried the width and height attributes in the tag; I believe they are not support by wx.html module.

I’ve been having a hard time finding and or understanding information on the Internet what the methods of wx.html.HtmlWindow do. Like when does a method effect the widget and when does it effect the webpage content or how it’s displayed.

Does the wx.html module allow for scaling of an entire webpage?

I am using the wx.html.HtmlWindow widget for the first time. I'm a novice
with HTML(5) as well.

note that wx.html.HtmlWindow only support very basic, old-style html
-- no where near HTML5! Still very useful, but no where near a "full
featured" browser.

I have a problem with scaling the webpage to fit within the
initial size of the html widget.

In general, HTML is designed to scale itself to fit the Window your
drawing in -- the exception is fixed-size images, but for text, etc,
it should wrap itself to fit the space you have.

And this isn't just a wx.html limitation -- a well designed web site
should not require a particular size windows (though most do require a
minimum size to be worth using...)

The problem I have is knowing how to scale the webpage to scale up or down
to fit within the wx.html.HtmlWindow's initial size of 300 x 300.

as long as your images are a reasonable size, this should "just work"

from around the webpage content. There is some kind of margin, border,
outline or something that allows the left and bottom parts of the underlying
panel to be seen.

if you are seeing underlying panel, I suspect that the htmWindows is
not being sized properly -- did you use ex.GROW or wx.EXPAND when you
put it in a sizer?

I'd give the "widget inspection tool" a try -- it will likley show you
what's going on with your layout.

As a simple test case I am using the following HTML:
<html><body><img src="image.jpg" /></body></html>

Although adding width and height attributes to the <img> tag scales the
image; it's the <body> tag that I'd like to scale; for when there is more
then just an image.

you don't want to scale body -- you want that to fill up the space available...

Does the wx.html module allow for scaling of an entire webpage?

I think your problem is that the HTMLWindow itself isn't the size you
think it is -- the content should do what you want be default.

-Chris

···

On Fri, Mar 30, 2012 at 2:23 PM, DevPlayer <devplayer@gmail.com> wrote: