Embed a web browser into a page

C

Carbon Man

Hi,
I need to embed a web browser into a python page. I am coming from the MS
world where I created an app that all of it's interfaces were actually web
pages rendered in an Internet Explorer activex control. There was a object
hook that allowed you to call into the host environment from javascript.
Basically the host environment would receive the documentComplete event and
call a method in the document's Javascript passing in an object reference.
That reference would then be available for calls to be made from Javascript
back into the host environment.
I am just starting to explore the Pythonic programming jungle and I was
wondering if there is a way to do something similar that would work
cross-platform?
I guess there is much more complexity in it when you start to go across o/s
platform boundaries. The common web interface would then be Gecko or WebKit?
So can someone suggest what would be required to build a cross-platform
Python app that was capable of browsing HTML files, receiving events from
the browser, and that allows the embedded page to call host Python modules
from Javascript via an object reference? Or I am asking too much :)
 
D

Diez B. Roggisch

Carbon said:
Hi,
I need to embed a web browser into a python page. I am coming from the MS
world where I created an app that all of it's interfaces were actually web
pages rendered in an Internet Explorer activex control. There was a object
hook that allowed you to call into the host environment from javascript.
Basically the host environment would receive the documentComplete event
and call a method in the document's Javascript passing in an object
reference. That reference would then be available for calls to be made
from Javascript back into the host environment.
I am just starting to explore the Pythonic programming jungle and I was
wondering if there is a way to do something similar that would work
cross-platform?
I guess there is much more complexity in it when you start to go across
o/s platform boundaries. The common web interface would then be Gecko or
WebKit? So can someone suggest what would be required to build a
cross-platform Python app that was capable of browsing HTML files,
receiving events from the browser, and that allows the embedded page to
call host Python modules from Javascript via an object reference? Or I am
asking too much :)

The only thing that might work is Qt + webkit that is used as it's browser.
Everything else is not cross platform.

Diez
 
L

lkcl

Hi,
I need to embed a web browser into a python page. I am coming from the MS
world where I created an app that all of it's interfaces were actually web

"its" not "it's". "it apostrophe s" is short for "it is". so you've
said "i created an app that all of it is interfaces were actually web
pages. additions of apostrophes have resulted in lunar exploration
rockets crashing, amongst other things (programs written in
fortran...)

pages rendered in an Internet Explorer activex control.

wondering if there is a way to do something similar that would work
cross-platform?

well, if you want to run python under wine, and attempt to install
pythoncom-win32 under that, i _have_ had some success in getting
python 2.5 to work as a wine application, and worked with the wine
team to fix a number of critical bugs in the not-exactly-posix-
compliant MSVCRT.

so you _could_ conceivably get that up and running, and it would be
_kinda_ cross-platform. don't even think of using python 2.7 yet
because changes in python 2.7 make extensive use of message-mode
NamedPipes, and the wine NamedPipes infrastructure doesn't support
message-mode, and so screws up on critical things like the thread
module.

I guess there is much more complexity in it when you start to go across o/s
platform boundaries. The common web interface would then be Gecko orWebKit?

yes. so, therefore, you need to look at python-hulahop or
pywebkitgtk with patch #13 and webkit-glib/gdom (webkit with patch
#16401, or use my pre-patched tree - http://github.com/lkcl/webkit/tree/16401.master

So can someone suggest what would be required to build a cross-platform
Python app that was capable of browsing HTML files, receiving events from
the browser, and that allows the embedded page to call host Python modules
from Javascript via an object reference? Or I am asking too much :)

you're not asking too much - you're just asking for a whopping great
30mb of dependencies, whichever way you go.

if you'd like to help out, we _really_ do need builds of webkit for
win32, patched, which took a week, last time i tried - see
http://lkcl.net/webkit/cross-compile-gtk.notes.txt

and then win32 builds of pywebkitgtk on top of _that_.

either way, if you go the python-hulahop or the pywebkitgtk-patched +
webkit-patched route, you're in for about two weeks non-stop of
build / compilation / dependency-hunting, to get something going on
win32.

as i've done webkit-win32 once before, i will be in a position to
help advise you (and the bugs in gcc i encountered will likely have
been fixed by now in "official" releases).

whereas the python-hulahop build process you're likely to be the
first person ever, in the world, to try building python-hulahop for
win32.

l.
 
L

lkcl

The only thing that might work is Qt +webkitthat is used as it's browser.

you mean "its browser".
Everything else is not cross platform.

not quite true - python-hulahop should theoretically compile for win32
- it's just that nobody in their right mind has tried it :)

l.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,273
Latest member
DamonShoem

Latest Threads

Top