bonjour,
mes fenetres tkinter ont l'air de bloquer les print de mon programme ; c'est à dire que je n'ai plus d'affichage console de vol, masse etc ...
Savez vous pourquoi? merci

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
 
# Ce fichier abrite le code de calcul de matrice d'inertie
 
import os
import tkinter as Tk  
 
# Choix du matériau
 
fenetre = Tk.Tk()
fenetre.title('Choix du matériau')
var_choix=Tk.DoubleVar()
mvol=Tk.DoubleVar()
 
var_choix.set (0.0)
 
def masse_vol():
    mvol = var_choix.get()
    print ("Masse volumique du matériau choisi :", mvol, "kg/dm3")
    return mvol
 
 
choix_acier = Tk.Radiobutton(fenetre, text="Acier", variable=var_choix,
value="7.8")
choix_alu = Tk.Radiobutton(fenetre, text="Aluminium", variable=var_choix,
value="2.7")
choix_bronze = Tk.Radiobutton(fenetre, text="Bronze", variable=var_choix,
value="8.8")
choix_cuivre = Tk.Radiobutton(fenetre, text="Cuivre", variable=var_choix,
value="8.92")
choix_titane = Tk.Radiobutton(fenetre, text="Titane", variable=var_choix,
value="4.5")
choix_zinc = Tk.Radiobutton(fenetre, text="Zinc", variable=var_choix,
value="7.15")
 
bouton_valid = Tk.Button (fenetre, text="Validez", command = masse_vol)
 
choix_acier.pack(side = Tk.LEFT, padx = 5, pady = 5)
choix_alu.pack(side = Tk.LEFT, padx = 5, pady = 5)
choix_bronze.pack(side = Tk.LEFT, padx = 5, pady = 5)
choix_cuivre.pack(side = Tk.LEFT, padx = 5, pady = 5)
choix_titane.pack(side = Tk.LEFT, padx = 5, pady = 5)
choix_zinc.pack(side = Tk.LEFT, padx = 5, pady = 5)
bouton_valid.pack(side = Tk.LEFT, padx = 5, pady = 5)
 
fenetre.destroy
 
 
# Choix de la forme du volume
 
import os
from tkinter import *
import numpy as np
from math import *
 
# Création de la fenêtre principale (main window)
Mafenetre = Tk()
 
Mafenetre.title('Choix de la forme du volume')
Mafenetre.geometry('300x100+400+400')
 
def prog_barre_pleine():
 
 
## Données demandées ##
    x = float(input ("Saisissez une valeur x en m : ")) # valeur de x en m (cf figure)
    y = float(input ("Saisissez une valeur y en m : ")) # valeur de y en m (cf figure)
    z = float(input ("Saisissez une valeur z en m : ")) # valeur de z en m (cf figure)
 
    def volume():         # Calcul du volume d'une barre pleine
 
        nonlocal x, y, z
        vol = float(x*y*z)
        print ("Volume = ", x*y*z, "m3")
        return float(vol)
 
    def masse():
        mvol = float(masse_vol())
        m = mvol*vol   # Calcul de la masse
        print ("Masse =", round (m,3), "kg")
        return float(m)
 
## Calcul, en son centre de gravité, de la matrice d'inertie d'une barre pleine ##
 
def matrice_inertie (m, x, y, z):
    Ixx = float(m*(y**2+z**2)/12)
    Iyy = float(m*(x**2+z**2)/12)
    Izz = float(m*(x**2+y**2)/12)
    Pxy = 0
    Pxz = 0
    Pyz = 0
 
    mat_inertie = np.array([[Ixx,-Pxy,-Pxz],[-Pxy,Iyy,-Pyz],[-Pxz,-Pyz,Izz]])
    print ("Matrice d'inertie =", mat_inertie)
    return mat_inertie
 
# Création d'un widget Button (bouton barre_pleine)
Barre_pleine = Button(Mafenetre, text ='Barre pleine', command = prog_barre_pleine)
# Positionnement du widget avec la méthode pack()
Barre_pleine.pack(side = LEFT, padx = 5, pady = 5)
 
 
# Création d'un widget Button (bouton Quitter)
BoutonQuitter = Button(Mafenetre, text ='Quitter', command = Mafenetre.destroy)
BoutonQuitter.pack(side = LEFT, padx = 5, pady = 5)
 
Mafenetre.destroy