|
From: Kevin A. <al...@se...> - 2001-08-27 15:57:38
|
Since we might follow the CSS syntax for fonts, I thought it would be a good
time to look at wxHtmlWindow in wxPython. It might even be time to wrap the
wxHtmlWindow as another widget for PythonCard. Anyway, if you want to play
with it, you can just open up the minimal sample and then work from the
shell.
C:\python\PythonCardPrototype>samples\minimal\minimal.py -s
>>> bg = pcapp.getCurrentBackground()
>>> comp = bg.components
>>> from wxPython.wx import *
>>> from wxPython.html import *
>>> import wxPython.lib.wxpTag
>>> p = bg.panel._getDelegate()
>>> h = wxHtmlWindow(p, -1, (0, 30), (800, 500))
>>> h.LoadPage("../../docs/html/index.html")
Resize the minimal window in order to fit the HTML; you can also change the
size (800, 500) to fit your display resolution. You'll notice that the home
page doesn't actually display correctly, this is a limitation of
wxHtmlWindow. According to Robin: "Currently wxHTML is a simple subset of
just HTML 4." Of course, after I started this test, I found out the control
doesn't currently support CSS, which is part of the reason our home page and
samples don't display correctly. Also, it doesn't automatically handle URL
downloading when you click on links, except for local file references.
Read the wxHtmlWindow section of the wxWindows documenation. Look at the
wxHtmlWindow example in demo.py (wxPython) "Non-managed Windows" section.
And finally, you might want to search for "html" or "wxHtmlWindow" issues in
the wxpython-users mailing list:
http://aspn.activestate.com/ASPN/search?query=html&type=Archive_wxPython-use
rs
If someone would like to investigate wxHtmlWindow and summarize the
limitations, features we should add, etc. then that would be great. Someone
could also make an html sample as an experiment. Note you are not going to
be able to make a full-featured browser using this control.
Since PythonCard is built on top of wxPython, you can use wxPython directly
whenever you want, which many of the samples do. Eventually, those wxPython
elements will be wrapped by the PythonCard framework, but you can see how
easy it is to experiment and see which parts of wxPython we want to add.
ka
|