Hi!

"javascript support" need more details:
  - only the (abstract) language?
  - or, also, visuals aspects?


On Windows, you can use,easily, the language (JScript). Example:

import win32com.client
js=win32com.client.Dispatch('ScriptControl')
js.language='jscript'

src="""function jmul2(x){
    r=(x++)*2;
    return r;
}
"""
js.addcode(src)
print js.eval("jmul2(111);")   # => 222


This simple example show how define & use a function in Javascript code. 
By the same way, you can mixer javascript, perlscript, vbscript, 
rubyscript, phpscript, etc.


Now, for the visual aspect of the question, you must work differently. 
On way is to work in HTA (HTml Application). Inside HTA, there are a 
"simili-browser", able to render HTML code, and run Javascript & 
Pythonscript (a bit different from PythonC).

Here un example:

<hta:application
 windowstate="normal"
 caption="no"
 singleinstance="yes"
/>
<html>
<head>
<script language=Python>

def Init():
    self.resizeTo(360,360)
    self.moveTo(110,10)

def meteo(num):
    obj = document.getElementById('METEODIV')
    st = '<a href="http://ponx.org/ponx/guie.htm";><img 
src="http://meteo.region-nord.com/webmestre/prev/j'+num+'.jpg" 
alt="prevision meteo" style="border:none"> </a>'
    obj.innerHTML = st

</script>
</head>

<body  bgColor=#FFFFFF background="" scroll=no onload="Init();">
<FORM>
&nbsp;&nbsp;
<input ID="bt1" name="bt1" type="button" style="width:100px" 
VALUE="Aujourd'hui"  onmousedown="meteo('1')" />
<input ID="bt2" name="bt2" type="button" style="width:100px" 
VALUE="Demain"  onmousedown="meteo('2')" />
<input ID="bt3" name="bt3" type="button" style="width:100px" 
VALUE="Après-Demain" onmousedown="meteo('3')" /><br>

<blockquote>
<DIV id="METEODIV">MMEETTEEOO</DIV>
</blockquote>
</FORM>

<script language=Python>
meteo('1')
</script>

</body>
</html>


Warning: ActiveScripting must be authorized (inside IE)



Another way is to drive Interne-Explorer from Python. it's possible to 
call (& return) Javascript functions & code, from Python, with 
parameter.
It's more complicated, but with more possibilities. For PLUIE, it's the 
way which I chose.


@-salutations

Michel Claveau



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to