# -*- coding: cp1252 -*- import _winreg,sys try: name, value, typ = _winreg.EnumValue(_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\Classes\CLSID\{EC501258-201C-449C-BE20-837A316EA382}\PythonCOMPath'), 0) if not sys.path.__contains__(value): sys.path.append(value) except: pass import pluie, time, os def cree(): g0=pluie.ggroup() t1=pluie.glabel(label='Ceci est un texte') ch1=pluie.gchamp(ID='CH1', label='Calcul') ch2=pluie.gchamp(ID='CH2', label='Résultat') br=pluie.gbr(nb=2) c1=pluie.gbutton(ID='BTCALC', label='Calculer') c2=pluie.gbutton(ID='BTQUIT', label='Quitter') g0.insert(br, t1, br, ch1,ch2, br, c1,c2) pluie.gwrite(g0, template='pluie___.htm', fichier='temp.htm') return g0 def utilise(): g=pluie.pluie('temp.htm', width=420, height=400) ch1=g.ie.connectid('CH1') ch2=g.ie.connectid('CH2') ch1.value='' ch2.value='' ch1.focus() while True: if not g.getnextaction(): if g.type=='break': print 'pluie cassé.' break else: time.sleep(0.050) else: if g.type=='clic': if g.cible=='BTCALC': try: result=eval(ch1.value, locals(),locals()) except: result='Erreur dans le calcul.' ch2.value=result if g.cible=='BTQUIT': print "Le bouton 'Quitter' a été cliqué." g.close() break cree() utilise()