Bonjour,

je suis étudiante en prépa, et nous avons un projet informatique à mener à bien.
Nous avons choisit de créer un logiciel d'identification floral,qui comprendrai une partie "création" pour ajouter une fleur à une base de données.
Afin de rentrer certains critères de la fleurs, nous aimerions utiliser un menu déroulant.

J'ai utiliser pour ça la fonction tix
Mon menu déroulant marche bien lorsque je le créé seul
Cependant, quand je l'intègre à notre fenêtre, le fait de sélectionner un choix dans le menu déroulant ne me renvoie plus la variable dans la fenêtre active de python, comme il est sensé le faire pour qu'on puisse la réutiliser plus tard....
Je ne comprends pas pourquoi le simple fait de l'ajouter à la fenêtre entraîne le fait qu'il ne renvoi rien.


Je vous joins un bout du programme, qui est à l'origine de mon problème... (il y a encore pas mal de truc à modifier dans le programme, on est au courant )
En esperant que vous puissiez nous aider!! 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
107
108
109
110
111
112
113
114
liste_couleur = ['jaune','rouge','vert']
 
from tkinter import *
from tkinter import tix
 
 
 
 
 
def ouvrir_fenetre_de_creation():
 
    fenetre_de_creation = tix.Tk()
    fenetre_de_creation.title('Création')
    fenetre_de_creation['bg'] = 'light blue'
    fenetre_de_creation.geometry('900x700+400+400')
 
    Nom_latin= Label(fenetre_de_creation, text = 'Nom latin')
    Nom_latin.grid(column = 1)
    Nom_latin.config(height=2, width=20, bg='light blue',font=('andalus',15 , 'bold'))
 
    Nom_vernaculaire= Label(fenetre_de_creation, text = 'Nom vernaculaire')
    Nom_vernaculaire.grid(column = 1)
    Nom_vernaculaire.config(height=2, width=20, bg='light blue',font=('andalus',15 , 'bold'))
 
    Couleur_petales= Label(fenetre_de_creation, text = 'Couleur des pétales')
    Couleur_petales.grid(column = 1)
    Couleur_petales.config(height=2, width=20, bg='light blue',font=('andalus',15 , 'bold'))
 
 
    Nombre_petales= Label(fenetre_de_creation, text = 'Nombre de pétales')
    Nombre_petales.grid(column = 1)
    Nombre_petales.config(height=2, width=20, bg='light blue',font=('andalus',15 , 'bold'))
 
    Petales= Label(fenetre_de_creation, text = 'Pétales')
    Petales.grid(column = 1)
    Petales.config(height=2, width=20, bg='light blue',font=('andalus',15 , 'bold'))
 
    Couleur_sepales= Label(fenetre_de_creation, text = 'Couleur des sépales')
    Couleur_sepales.grid(column = 1)
    Couleur_sepales.config(height=2, width=20, bg='light blue',font=('andalus',15 , 'bold'))
 
    Nombre_sepales= Label(fenetre_de_creation, text = 'Nombre de sépales')
    Nombre_sepales.grid(column = 1)
    Nombre_sepales.config(height=2, width=20, bg='light blue',font=('andalus',15 , 'bold'))
 
    Sepales= Label(fenetre_de_creation, text = 'Sépales')
    Sepales.grid(column = 1)
    Sepales.config(height=2, width=20, bg='light blue',font=('andalus',15 , 'bold'))
 
    Nombre_etamines= Label(fenetre_de_creation, text = "Nombre d'étamines")
    Nombre_etamines.grid(column = 1)
    Nombre_etamines.config(height=2, width=20, bg='light blue',font=('andalus',15 , 'bold'))
 
    Feuilles= Label(fenetre_de_creation, text = "Feuilles")
    Feuilles.grid(column = 1)
    Feuilles.config(height=2, width=20, bg='light blue',font=('andalus',15 , 'bold'))
 
    Vide=Label(fenetre_de_creation, text = "\t", width = 3)
    Vide.config(bg = 'light blue')
    Vide.grid(column = 2)
 
    Latin = Entry(fenetre_de_creation, bg ='white', fg='maroon', font=('andalus',15 , 'bold'))
    Latin.focus_set()
    Latin.grid(row = 0, column = 3)
 
    Vernaculaire = Entry(fenetre_de_creation, bg ='white', fg='maroon', font=('andalus',15 , 'bold'))
    Vernaculaire.focus_set()
    Vernaculaire.grid(row = 1, column = 3)
 
    def Affiche(evt):
        return (var.get())
    var= tix.StringVar() 
    comboBoxOption = tix.ComboBox(fenetre_de_creation, editable=0, dropdown=1, variable=var, command = Affiche)
    k = 0
    for x in liste_couleur :
        comboBoxOption.insert(k, x)
        k = k + 1
    comboBoxOption.grid(row=2, column=3)
 
    var= tix.StringVar() 
    comboBoxOption = tix.ComboBox(fenetre_de_creation, editable=0, dropdown=1, variable=var, command = Affiche)
    k = 0
    for x in liste_couleur :
        comboBoxOption.insert(k, x)
        k = k + 1
    comboBoxOption.grid(row=5, column=3)
 
def ouvrir_fenetre_recherche():
 
    fenetre_recherche = tix.Tk()
    fenetre_recherche.title('Recherche')
    fenetre_recherche['bg'] = 'purple'
    fenetre_recherche.geometry('900x700+400+400')
 
def ouvrir_fenetre_import():
 
    fenetre_import = tix.Tk()
    fenetre_import.title('Import')
    fenetre_import['bg'] = 'orange'
    fenetre_import.geometry('900x700+400+400') 
 
 
Mafenetre = Tk()
Mafenetre.title('identiflore')
Mafenetre['bg'] = 'light green'
Ouverture= Label(Mafenetre, text = "Bienvenue sur ce programme interactif \n d'identification florale !")
Ouverture.config(height = 3, width = 800, bg='light green',font=('andalus',20 , 'bold'))
Ouverture.pack()
 
Mafenetre.geometry('800x600+400+400')
 
BoutonCreation = Button(Mafenetre, text = 'CREATION', command = ouvrir_fenetre_de_creation)
BoutonCreation.pack(side = LEFT, padx = 40, pady = 2)
BoutonCreation.config(height=3, width=13, font=('comic sans ms',15 , 'bold'))