HTML window not wrapping page

I tried the code below but can’t figure out how to get my html text auto wrapped. But the one in wxPython demo works just perfect, any idea?

···

import wx

import wx.html as html

class Frame(wx.Frame):

def init(self, parent):

wx.Frame.init(self, None, wx.ID_ANY, ‘HTML Frame’, size=(500, 500))

panel = wx.Panel(self, -1)

self.html = html.HtmlWindow(panel, -1, style=wx.NO_FULL_REPAINT_ON_RESIZE)

self.html.SetRelatedFrame(self, “–”)

self.html.SetPage(‘hahahahahahahahahahahahahahahahahahahahahahahaha’)

panel.box = wx.BoxSizer(wx.VERTICAL)

panel.box.Add(self.html, 1, wx.GROW)

panel.SetSizer(panel.box)

panel.SetAutoLayout(True)

self.Show()

def main():

app = wx.App()

frame = Frame(None)

app.MainLoop()

if name == “main”:

import sys,os

main()

Yuming Cao wrote:

I tried the code below but can't figure out how to get my html text
auto wrapped. But the one in wxPython demo works just perfect, any idea?

What were you expecting here? First, 500 pixels is more than wide
enough to to display the text you provided. Second, there's no place to
break that string, since it's all one word.

Try this, and you'll see the wrapping in action:
    self.html.SetPage('word ' * 400)

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.