[Q] In-Browser technology

Robin Becker robin at jessikat.demon.co.uk
Wed Jul 21 06:20:32 EDT 1999


In article <7n42qo$6ug$2 at news.accu.uu.nl>, Martijn Faassen
<m.faassen at vet.uu.nl> writes
>[this reply only posted to comp.lang.python -- hope Vladik sees it :)]
>
>In comp.lang.python Vladik <reason at shadow.net> wrote:
>> OK, I will try to clarify my question.
>> With the warning that I may not be speaking
>> authoritatively about the web technologies yet:
>> I am just starting this research.
>
>Having followed this thread a little, I still am not sure how much 
>in browser technology the system you're describing actually _needs_. You
>can do a lot with dynamically generated HTML from the server, and some
>JavaScript.
>
>Client side action in browsers is hard to do with Python (and Perl and
>Eiffel), though I'd wish. Although I must mention jpython here, a version
>of Python that runs on top of a Java virtual machine, and can therefore
>be used in 'Java' applets (www.jpython.org).
>
>For the server side, where you'd have your business rules and database
>functions presumably, I recommend you take a look at Zope. Of course I'm 
>biased to Python, and Zope uses Python, but it's really very
>very nice. Check it out at: http://www.zope.org
>
>Browser technology is hard to do with Python (and Perl and Eiffel) -- 
>browsers don't tend to support these languages. 
>
>Regards,
>
>Martijn
>
python has with Mark Hammond's assistance got to the stage where it
works with wsh so it can also appear in ie html. It's a real pity that
no-one got around to making the equivalent of a plugin for python, but
from using the tcl plugin I know that this is tough to get right and
there are a whole load of other issues eq who manages the events,
security etc etc.

I think I detect some confusion about the actual requirements. Pure java
applets live on the server as apparently does the juice applet these
have to be downloaded to the Java/Juice/Tcl plugins.

The scriptlets JScript, VBScript, PyScript and for all I know
JuiceScript live in the HTML and also have to be downloaded (along with
the HTML). The browser farms them off to the relevant interpreter.

The ASP is done purely on the server; Zope is also a dynamic server in
this sense.


########### sample of a python script in html
<HTML>
<BODY>

<SCRIPT>
b="Hello"
</SCRIPT>

<SCRIPT LANGUAGE="Python">
import win32traceutil
print "Hello"
a="Hi there"
print "Location is", document.location
document.write("Hello", " from version ", 2, " of the Python AXScript
Engine","<P>")
document.writeln("Hello again")

</SCRIPT>

<P>The caption on the first button is set by the Window Load code.
Clicking
that button changes the text in the first edit box.

<P>The second button changes its own text when clicked.

<P>The fourth button calls a global function, defined in the global
'script' scope,
rather than the 'MyForm' scope.

<FORM NAME="MyForm" METHOD="GET">
   <SCRIPT LANGUAGE="Python">
print "Hello from in the form"
   </SCRIPT>
   <INPUT NAME="Button1" TYPE="Button" OnClick="MyForm.Text1.value='Hi'"
LANGUAGE="Python">
   <INPUT TYPE="TEXT" SIZE=25 NAME="Text1">
   <INPUT NAME="Button2" TYPE="Button" VALUE="Click for 'Hi'"
OnClick="a='Howdy'; MyForm.Button2.value='Hi'" LANGUAGE="Python">
   <INPUT NAME="Button3" TYPE="Button" VALUE="Click for URL" OnClick="My
Form.Text2.value=document.location" LANGUAGE="Python">
   <INPUT TYPE="TEXT" SIZE=25 NAME="Text2">
   <INPUT NAME="Button4" TYPE="Button" VALUE="Call global fn"
OnClick="foo1()" LANGUAGE="Python">
   <INPUT_NAME="Button5" TYPE="Button" VALUE="Script for... Test">
<script for="Button5" event="onClick" language="Python">
print "HelloThere";
window.alert("Hello")
def ATest():
        print "Hello from ATEst"

ATest()
</script>
   <INPUT NAME="Button6" TYPE="Button" VALUE="Set Other"
OnClick="Form2.Text1.Value='Hi from other'" LANGUAGE="Python">

</FORM><BR>
<P>
And here is a second form
<P>
<FORM NAME="Form2" METHOD="GET">
   <INPUT NAME="Button1" TYPE="Button" OnClick="Form2.Text1.Value='Hi'"
LANGUAGE="Python">
   <INPUT NAME="Button2" TYPE="Button" VALUE="Set Other" OnClick="MyForm
.Text1.Value='Hi from other'" LANGUAGE="Python">
   <INPUT TYPE="TEXT" SIZE=25 NAME="Text1">
   <INPUT NAME="ButRExec" TYPE="Button" VALUE="RExec fail"
OnClick="import win32api;win32api.MessageBox(0,'Oops')"
LANGUAGE="Python">
   <INPUT NAME="ButRExec2" TYPE="Button" VALUE="RExec fail 2"
OnClick="import sys,win32traceutil;print sys.modules;from
win32com.client import dynamic;import win32com.client.dynamic,
pythoncom, win32com.client;o=win32com.client.Dispatch('Word.Application'
)" LANGUAGE="Python">
   <INPUT NAME="ButVB" TYPE="Button" VALUE="VBScript Button"
OnClick='alert("Hi from VBScript")'>
</FORM><BR>

<SCRIPT LANGUAGE="Python">
x=13

def foo1():
   y = 14
   for name, item in globals().items():
        print name, `item`
   alert ("Hello from AXCode")
   print "Y is ",y

def Window_OnLoad():
        print "X is", x
        print "a is", a
        print "MyForm is", `MyForm`
        print "MyForm.Button1 is", `MyForm.Button1`
        MyForm.Button1.Value = "Python Rules!"
        Form2.Button1.value = "Form2!"
        MyForm.Text1.value = document.location
</SCRIPT>

</BODY>
</HTML>
-- 
Robin Becker




More information about the Python-list mailing list