Mar-29-2020, 03:30 PM
Hi every one,
i read this documentation for lock the resizable column and headers too
but not work.
here is my code
thank you in advance for your time
i read this documentation for lock the resizable column and headers too
but not work.
here is my code
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 |
# coding:utf-8 #version 3.x python 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() |