Bonjour, je cherche a récupérer dans une combobox non pas la séléction mais bien le "numéro" de cette selection...
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
class Frame_principal (Tk.Frame):
 def __init__(self, parent):
 
  Tk.Frame.__init__(self, parent)
 
  self.varcombo_left = Tix.StringVar()
  self.combo_left = Tix.ComboBox(self, editable=1, dropdown=1, variable=self.varcombo_left)
  self.combo_left.entry.config(state='readonly')
  self.combo_left.insert(1, "-- ")
  self.combo_left.insert(2, "^ ")
  self.combo_left.insert(3, "-- ] ")
  self.combo_left.insert(4, "< ")
  self.combo_left.insert(5, ">( ")
  self.combo_left.insert(6, "[ ")
  self.combo_left.insert(7, '7')
  self.combo_left.insert(8, '8')
  self.combo_left.insert(9, '9')
  self.combo_left.insert(10, '10')
  self.combo_left.insert(11, '11')
  self.combo_left.insert(12, '12')
  self.combo_left.insert(13, '13')
  self.combo_left.insert(14, '14')
  self.combo_left.insert(15, '15')
  self.combo_left.insert(16, '16')
  self.combo_left.insert(17, '17')
  self.combo_left.insert(18, '18')
  self.combo_left.insert(19, '19')
  self.combo_left.insert(20, '20')
  self.combo_left.insert(21, '')
  self.combo_left.grid(row=1, column=1)
Frame_principal()
 
mainloop ()
Donc, par exemple, je sélectionne " -- " qui correspond au numéro 1 de self.combo_left.insert.
J'aimerais faire un print self.varcombo_left.get() mais avec le 'numero de code' de la séléction...