Hello,
Piloter VML avec Python, voici ce qu'illustre ce code.
Les applications sont nombreuses, visualiser en temps réel
les resources systèmes par exemples.
Voici le code :
<hta:application
windowstate="normal"
border="thin"
borderstyle = "normal"
caption="yes"
maximizeButton="yes"
singleinstance="yes"
SCROLL="no"
/>
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:v="urn:schemas-microsoft-com:vml"
xml:lang="en" lang="en">
<head>
<title>PyVMLClock2</title>
<style type="text/css">
h1 { text-align: center; margin-bottom: 100px; }
v\:* { behavior: url(#default#VML); }
</style>
</head>
<body onLoad="Initialisation()">
<center>
<div>
<v:group
style="position:absolute;top:10;left:10;width:200p x;height:200px;"
coordsize="400, 400" coordorigin="0, 0">
<!-- Emprunte a Josi sur
http://webdeveloper.earthweb.com/webjs/jstimedate/item.php/26361-->
<v:group style="position:absolute;top:0;left:0;
width:200px;height:200px;" coordsize="50, 50" coordorigin="0, 0"" >
<v

val style="width: 2; height: 2; left: 49; top: 1"
fillcolor="#c0c000" />
<v

val style="width: 2; height: 2; left: 97; top: 49"
fillcolor="#c0c000" />
<v

val style="width: 2; height: 2; left: 1; top: 49"
fillcolor="#c0c000" />
<v

val style="width: 2; height: 2; left: 49; top: 97"
fillcolor="#c0c000" />
<v

val style="width: 2; height: 2; left: 8; top: 25"
fillcolor="#c0c000" />
<v

val style="width: 2; height: 2; left: 73; top: 8"
fillcolor="#c0c000" />
<v

val style="width: 2; height: 2; left: 25; top: 8"
fillcolor="#c0c000" />
<v

val style="width: 2; height: 2; left: 90; top: 25"
fillcolor="#c0c000" />
<v

val style="width: 2; height: 2; left: 8; top: 73"
fillcolor="#c0c000" />
<v

val style="width: 2; height: 2; left: 25; top: 90"
fillcolor="#c0c000" />
<v

val style="width: 2; height: 2; left: 73; top: 90"
fillcolor="#c0c000" />
<v

val style="width: 2; height: 2; left: 90; top: 73"
fillcolor="#c0c000" />
</v:group>
<!-- Fin Emprunt -->
<v:shape id="seconde" style="width:400;height:400;rotation:0.0"
stroked="true" strokecolor="blue"
path="m 200 10 l 200 230 e" />
<v:shape id="minute" style="width:400;height:400;rotation:0.0"
stroked="true" strokecolor="blue"
path="m 200 10 l 200 230 e" />
<v:shape id="heure" style="width:400;height:400;rotation:0.0"
stroked="true" strokecolor="green"
path="m 200 50 l 200 230 e" />
</v:group>
</div>
</center>
<script language="Python">
import time
import math
pi = math.pi
s = 0
m = 0
h = 0
angles = 0
anglem = 0
angleh = 0
def RotatePython():
global angles, anglem, angleh
angles += 6.0
anglem += 0.1
angleh += 30.0/3600
s = document.getElementById("seconde")
s.style.rotation = str(angles)
m = document.getElementById("minute")
m.style.rotation = str(anglem)
h = document.getElementById("heure")
h.style.rotation = str(angleh)
def Initialisation():
global s,m,h,angles,anglem,angleh
x,x,x,h,m,s,x,x,x = time.localtime()
angles = s*6.0
anglem = (m+s/60.0)*6.0
angleh = (h+m/60.0+s/3600.0)*30
sp = document.getElementById("seconde")
tempo = window.setInterval("RotatePython()", 1000)
window.resizeTo(230,252)
</script>
</body>
</html>