1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| import tkinter as tk
import math
import numpy as np
#Definition des constantes physiques
c=299792.458e3
h=6.6260693e-34
k=1.3806505e-23
# Nombre de points
npoints=10000
# Limites
l_min=3e-9
l_max=4*1e-6
# Liste des longueurs d'onde pour le calcul de la loi de Planck
fenetre = tk.Tk()
fenetre.geometry("750x800")
fenetre.title('Rayonnement du Corps noir')
def traceCourbeRj():
liste=[]
T=5000
l= np.logspace(np.log10(l_min),np.log10(l_max),2500)
for i in range(npoints):
cl=(8*np.pi*h*c)/(l**5) * 1/(np.exp((h*c)/(k*l*T))-1)
liste.append((l[i],cl))
n = zone_graphique.create_line(liste, fill='red', smooth=1)
return n
traceCourbeRj() bouton_quitter = tk.Button(fenetre, text='Quitter',bg='red', command=fenetre.destroy)
bouton_quitter.place(x = 455 , y = 50 , width = 126)
zone_graphique = tk.Canvas(fenetre, width=730, height = 470, background='ivory')
zone_graphique.place(x = 7 , y = 320 )
fenetre.mainloop() |
Partager