Bonjour,

Description du code :
Dans un premier temps j'ai juste créer les entrées et l'utilisateur doit entrer une à une toute les valeurs.
Ensuite j'ai rajouté la combobox mais elle n'a pas d'utilité pour l'instant.

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
 
# Calcul du taux de travail en traction
# -*- coding: ISO-8859-1 -*-
 
from Tkinter import *
import Pmw
 
# liste pour combobox
 
classemecanique = ('C18','C22','C24','GL24h','GL32h')
 
# création de la fenetre
 
fen1=Pmw.initialise()
fen1.title("Vérification du taux de travail en compression")
 
# création de widgets 'Label' et 'Entry' :
tex01 = Label(fen1, text='Vérification du taux de travail en compression.')
tex02 = Label(fen1, text='Définition de l élément étudié')
txt1 = Label(fen1, text = 'Base, b en mm :')
txt2 = Label(fen1, text = 'Hauteur, h en mm :')
txt3 = Label(fen1, text = 'ft,0,k en MPa :')
txt4 = Label(fen1, text = 'Gm :')
txt5 = Label(fen1, text = 'kh :')
tex03 = Label(fen1, text='Définition de l effort')
txt6 = Label(fen1, text = 'N en N :')
txt7 = Label(fen1, text = 'kmod :')
entr1 = Entry(fen1)
entr2 = Entry(fen1)
entr3 = Entry(fen1)
entr4 = Entry(fen1)
entr5 = Entry(fen1)
entr6 = Entry(fen1)
entr7 = Entry(fen1)
 
# Mise en place de combobox :
combo = Pmw.ComboBox(fen1, labelpos = NW,
                     label_text = 'Choisissez la classe mécanique :',
                     scrolledlist_items = classemecanique,
                     listheight = 150)
combo.grid(row =13, columnspan =2, padx =10, pady =10)
 
 
 
 
# Mise en page à l'aide de la méthode 'grid' :
tex01.grid(row =1, sticky =W)
tex02.grid(row =2, sticky =W)
tex03.grid(row =8, sticky =W)
txt1.grid(row =3, sticky =E)
txt2.grid(row =4, sticky =E)
txt3.grid(row =5, sticky =E)
txt4.grid(row =6, sticky =E)
txt5.grid(row =7, sticky =E)
txt6.grid(row =9, sticky =E)
txt7.grid(row =10, sticky =E)
entr1.grid(row =3, column =2)
entr2.grid(row =4, column =2)
entr3.grid(row =5, column =2)
entr4.grid(row =6, column =2)
entr5.grid(row =7, column =2)
entr6.grid(row =9, column =2)
entr7.grid(row =10, column =2)
 
 
# démarrage :
fen1.mainloop()
J'ai par ailleurs créé un fichier xml du genre :
A vrai dire je ne connais pas grand chose de la syntaxe que doit avoir un fichier xml...

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
 
<?xml version="1.0" ?>
<element_racine>
		<profil id="C18" mat="BM" essence="résineux" fmk="18" ftok="11" ft90k="0,5" fc0k="18" fc90k="2,2" fvk="2" E0m="9" E0k="6" E90m="0,3" Gm="0,56" Gk="0,38" pk="320" pm="380" gM="1,3"/>
		<profil id="C22" mat="BM" essence="résineux" fmk="22" ftok="13" ft90k="0,5" fc0k="20" fc90k="2,4" fvk="2,4" E0m="10" E0k="6,7" E90m="0,33" Gm="0,63" Gk="0,42" pk="340" pm="410" gM="1,3"/>
		<profil id="C24" mat="BM" essence="résineux" fmk="24" ftok="14" ft90k="0,5" fc0k="21" fc90k="2,5" fvk="2,5" E0m="11" E0k="7,4" E90m="0,37" Gm="0,69" Gk="0,46" pk="350" pm="420" gM="1,3"/>
</element_racine>
Je souhaite que certaines entrées soit remplies automatiquement en fonction du choix fait dans la combobox.
On m'a parlé des bibliothèque minidom et elementtree mais je ne sais pas comment les mettre en application.
J'imagine que ce n'est pas extraordinaire à réaliser mais je ne trouve pas de piste sur le net pour me renseigner. Est ce que vous auriez des indices ou un bout de code pour m'aider?

Amicalement
Jo