bonjour à tous,

j'ai testé selon la doc
mais je n'obtient pas le résultat escompté.
La colonne s'élargie toujours (largeur augmente), alors que je veux quelle soit totalement verrouillée

voici le script et merci votre temps

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
 
# coding:utf-8
#version 3.x python
# DOC --> https://www.tcl.tk/man/tcl8.5/TkCmd/ttk_treeview.htm#M17
 
from tkinter import *
from tkinter.ttk import *
import sqlite3
 
# Connexion DB
con = sqlite3.connect("HE.db")
cur = con.cursor()
cur.execute("SELECT id, HE_Nom, HE_Prop, HE_Dosage FROM HE ORDER BY HE_Nom ASC")
mData = cur.fetchall()
print("Nombre d'enregistrement", len(mData))
 
win = Tk()
win.title('Huiles Essentiels')
win.geometry("820x559+30+30")
 
# Frame
frm = Frame(win)
frm.place(x=10, y=10, width=600, height=150)
 
# Treeview & Y Scrollbar Vertical & X Scrollbar Vertical
scrollbar_y = Scrollbar(frm)
scrollbar_y.place(x=580, y=2, height=149)
 
tv=Treeview(frm, selectmode="browse", columns=(1,2,3), show="headings", height="5", yscrollcommand=scrollbar_y.set)
    # En-tête
tv.heading(1, text="HE", anchor=W)
tv.heading(2, text="Description", anchor=W)
tv.heading(3, text="Dosage", anchor=W)
 
tv.column('#1', width=150, minwidth=150, stretch=False)
tv.column('#2', width=350, minwidth=350, stretch=False)
tv.column('#3', width=50, minwidth=50, stretch=False)
tv.place(x=2, y=2, width=578, height=180)
# tv.columnconfigure(1, pad=10)
# tv.columnconfigure(2, weight=0)
# tv.columnconfigure(3, weight=0)
 
scrollbar_y.config(command=tv.yview)
 
    # Affichage
a = 0
for i in mData:
    tv.insert('', 'end', text=i[0], values=(i[1],i[2],i[3]))
    print("Index", i[0])
    a = a + 1
print("Nombre d'enregistrement", a)
 
 
win.mainloop()