Embedding an Application in a Web browser

R

rodmc

Is it possible to embed a Python application within Internet explorer?
If so how do people recommend going about it.

As for the application it has to be able display simple animated
graphics such as circles, lines and squares. However if someone clicks
on a shape it should open up another application, such as Word.

Thanks,

Rod

Python Newbie
 
B

bruno at modulix

rodmc said:
Is it possible to embed a Python application within Internet explorer?

No. Nor in any other browser (except from Grail, but I think this
doesn't count).
If so how do people recommend going about it.

Either write a rich client app or a real web application.
As for the application it has to be able display simple animated
graphics such as circles, lines and squares.

Wait... Aren't there already existing technos to do this ?
However if someone clicks
on a shape it should open up another application, such as Word.

Lol. This would be a really big bad security issue.

You definitively want to write a rich client app.
 
T

Tim N. van der Leeuw

'A' Web Browser? Meaning: any random web-browser? Or specifically and
*only* Internet Explorer?

If you want it to work only and ever only in Internet Explorer, then
you can create a Python ActiveX object and embed that in your page;
using the pythonwin extensions.

Cheers,

--Tim
 
R

rodmc

Thanks for all the comments.

I will elaborate slightly to give everyone an idea of what is going on.
Basically I need to create a dynamic visualisation which sits in the
active desktop, basically behind the desktop icons and in front of the
windows wallpaper. Windows lets you define a web page which can be
displayed in this way. The application itself can sit on the local
users computer, rather than actually being downloaded via the web. It
will be retrieving data from a variety of sources. If there is another
way to do it then that would be good, for example writing another
active desktop application which people can use.

The user has to be able to resize, move or get rid of the visualisation
if they wish to do so.

Best,

rod
 
A

Atanas Banov

try this: create file named "test.hta" and put inside
---------------------
<HTML>
<BODY>
<SCRIPT LANGUAGE="Python">

import sys
document.writeln("Hello from Python", sys.version)

</SCRIPT>
</BODY>
</HTML>
 
?

=?ISO-8859-1?Q?Michael_Str=F6der?=

bruno said:
No. Nor in any other browser (except from Grail, but I think this
doesn't count).

I remember there was a project for running CGI-BIN-like programs
directly in Mozilla without a web server.

But I can't find it anymore.

Ciao, Michael.
 
R

Roger Upole

Using the Pywin32 extensions
( http://sourceforge.net/projects/pywin32/ ) ,
you can register Python as an Active Scripting language.
Then it can be used anywhere javascript or vbscript are
used, in IE, ASP, etc. It should only be used in IE
for trusted applications, however.

Roger
 
D

DH

bruno said:
No. Nor in any other browser (except from Grail, but I think this
doesn't count).

You can if you use IronPython. Of course it will only work with
Internet Explorer on windows.
Java and JVM languages are of course much better for applets: jython,
groovy, jruby, etc. I don't know if jython or jruby applets are
actually possible however since it is interpreted.

Lol. This would be a really big bad security issue.

Look up Microsoft's smart client api. It is their answer to java web start.
 
P

paron

You may already know this, but I don't think anyone has mentioned it
explicitly.

You can run a Python web server (I like CherryPy) on the local machine,
and serve pages to "localhost." Everything else is just plain old
Python, and talking to the OS is no problem.

Ron
 
P

paron

I forgot -- I like the idea of Kerrigell, too. It runs on top of
CherryPy, and lets you use python either in the server (which is just a
little program on your local machine) or embedded in the html pages, or
in a Kerrigell service, which is an application server based on Python.

So, a script to print the squares of numbers from 1 to 9 looks like:

Python script +++++++++

print "<h1>Squares</h1>"
for i in range(10):
print "%s :<b>%s</b>" %(i,i*i)


Karrigell service ++++++++

def index():
print "<h1>Squares</h1>"
for i in range(10):
print "%s :<b>%s</b>" %(i,i*i)

HTML Inside Python +++++++

"<h1>Squares</h1>"
for i in range(10):
"%s :<b>%s</b>" %(i,i*i)

Python Inside HTML +++++++

<h1>Squares</h1>
<%
for i in range(10):
print "%s :<b>%s</b>" %(i,i*i)
%>

It's certainly flexible.

As far as your animated shapes go, you have a number of unattractive
options!

Flash (my preference, if you already have the authoring software,)
openLazslo (maybe the best bet for free),
SVG (which requires a plug-in for IE,) or
creating them and making them interactive with Javascript ( see
http://www.walterzorn.com/jsgraphics/jsgraphics_e.htm )

Ron
 
P

paron

I forgot -- I like the idea of Kerrigell, too. It runs on top of
CherryPy, and lets you use python either in the server (which is just a
little program on your local machine) or embedded in the html pages, or
in a Kerrigell service, which is an application server based on Python.

So, a script to print the squares of numbers from 1 to 9 looks like:

Python script +++++++++

print "<h1>Squares</h1>"
for i in range(10):
print "%s :<b>%s</b>" %(i,i*i)


Karrigell service ++++++++

def index():
print "<h1>Squares</h1>"
for i in range(10):
print "%s :<b>%s</b>" %(i,i*i)

HTML Inside Python +++++++

"<h1>Squares</h1>"
for i in range(10):
"%s :<b>%s</b>" %(i,i*i)

Python Inside HTML +++++++

<h1>Squares</h1>
<%
for i in range(10):
print "%s :<b>%s</b>" %(i,i*i)
%>

It's certainly flexible.

As far as your animated shapes go, you have a number of unattractive
options!

Flash (my preference, if you already have the authoring software,)
openLazslo (maybe the best bet for free),
SVG (which requires a plug-in for IE,) or
creating them and making them interactive with Javascript ( see
http://www.walterzorn.com/jsgraphics/jsgraphics_e.htm )

Ron
 
K

Kent Johnson

paron said:
I forgot -- I like the idea of Kerrigell, too. It runs on top of
CherryPy

Karrigell is independent of CherryPy, it has it's own web server built in.

Kent
 
M

Magnus Lycka

bruno said:
No. Nor in any other browser (except from Grail, but I think this
doesn't count).

This is simply not true!

Python can work as a Windows scripting language just as VB Script.
That means that IE can use Python just as it can use JScript or
VB Script for client side scripting in the browser.

For instance, see here:
http://www.4guysfromrolla.com/webtech/082201-1.shtml

Another issue is whether this was advisable from a security point
of view... Python isn't written to be safe. I don't want Python
client side scripting enabled in my browser... (Not that I use
IE when I can avoid it...)
 
A

Atanas Banov

paron said:
I forgot -- I like the idea of Kerrigell, too. It runs on top of
CherryPy, and lets you use python either in the server (which is just a
little program on your local machine) or embedded in the html pages, or
in a Kerrigell service, which is an application server based on Python.

oh sure, why make it simple, when we can make it difficult?!
your solution is like using a sledgehammer to crack a nut!

"... I keep hearing the sound of nuts being pulverized..."
http://www.bobcongdon.net/blog/2005/11/java-sledgehammer.html
 
P

paron

From the OP:
<snip>As for the application it has to be able display simple animated
graphics such as circles, lines and squares. However if someone clicks
on a shape it should open up another application, such as Word. Thanks,

Rod

Python Newbie </snip>

<snip>The application itself can sit on the local
users computer, rather than actually being downloaded via the web. It
will be retrieving data from a variety of sources.</snip>

I was thinking that the security provisions might make it difficult for
the script in the browser to interact with the OS. If that is "simple"
to get around, then I agree, Karrigell is overkill.

OTOH, Karrigell makes it simple to interact with the local machine's
OS, and especially if you are a beginner at Python. YMMV, of course.
Thanks for offering your opinion.

Ron
 
P

Paul Boddie

Atanas said:
oh sure, why make it simple, when we can make it difficult?!

I don't see how running a local Web application server is more
difficult than messing around with ActiveX and/or Active Scripting (or
whatever it's called). Remember that Python already has various HTTP
server classes in the standard library, and making use of these classes
is very easy. I'd rather do that than touch ActiveX with a very long
stick, and the Active Scripting stuff, whilst amusing, is a known
security concern.
your solution is like using a sledgehammer to crack a nut!

"... I keep hearing the sound of nuts being pulverized..."
http://www.bobcongdon.net/blog/2005/11/java-sledgehammer.html

Why am I not surprised that the first three words of the quoted blog
article are "David Heinemeier Hansson"? Few people contributing to
comp.lang.python would suggest J2EE as a solution here, so I don't
quite see what relevance this particular hype echo from the blogosphere
has in this case, especially since running BaseHTTPServer isn't exactly
like running JBoss.

Sure, to have animated graphics is likely to stretch any Web-based
interface, despite recent support for things like SVG and
"destandardised" innovations like canvases in Web browsers. But if
cross-platform portability ever becomes an issue, the vanilla Web
application option is quite possibly the best route; whilst one can
embed Python in Konqueror with the right packages today, and whilst
support for Python scripting in Mozilla is coming along, it'll be a
long time before any piece of Python code will be able to run on more
than one of these configurations without modification. And beyond
Active Scripting, who can really be sure what Internet Explorer will
eventually support?

Paul
 

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

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top