Étape 2: le CODE
# Auteur : Mohamad Sigit Dude# Python : 2.7
# www.tokolampugorontalo.blogspot.com
# www.makebot.blogspot.com
# Dudelectric-microsystems
# Gorontalo 21/06/2013
###################################################
de Tkinter import *
def hapus(entry1,entry2,entry3,entry4,entry5) :
entry1.Delete (0, fin)
Entry2.Delete(0,end)
entry3.Delete (0, fin)
Entry4.Delete(0,end)
Entry5.Delete(0,end)
def hitungan(entry5) :
SV=int(Entry1.get())
LV=int(Entry2.get())
HM=int(entry3.get())
DC=int(Entry4.get())
op=(SV-(LV*HM))/(float(DC)/1000)
e.Set (« %.1f » % op)
fenêtre = Tk()
racine = Frame(window)
root.Pack()
Label1 = Label (root, text = "Tension d’alimentation (V)")
Label1.Pack(Side="left")
entry1 = entrée (root, largeur = 3, au premier plan = « red »)
entry1.Pack(Side="left")
Label2 = Label (root, text = "conduit Volt (V)")
Label2.Pack(Side="left")
Entry2 = Entry(root,width=3,foreground="purple")
Entry2.Pack(Side="left")
Label3 = Label (root, text = « combien leds »)
Label3.Pack(Side="left")
entrée3 = Entry(root,width=3,foreground="blue")
entry3.Pack(Side="left")
Label4 = Label (root, text = "Désiré courant (mA)")
Label4.Pack(Side="left")
Entry4 = Entry(root,width=4,foreground="orange")
Entry4.Pack(Side="left")
Label5 = Label (root, text = "Valeur de la résistance (ohm)")
Label5.Pack(Side="left")
e=StringVar()
Entry5 = Entry(root,width=10,background="cyan",highlightcolor="red",foreground="red",textvariable=e)
Entry5.Pack(Side="left")
Button1 = bouton (text = "GET VALUE",command=lambda:hitungan(entry5)).pack(side=RIGHT)
button2 = bouton (texte = "Clear All",command=lambda:hapus(entry1,entry2,entry3,entry4,entry5)).pack(side=BOTTOM)
Window.mainloop()