PB v2: barre de scroll tkinter
Bonjour à tous,
J'ai ajouté une barre de scroll à mon tableau python mais elle ne fonctionne bien
Si j'enlève le code concernant la barre de scroll (de défilement), le tableau est bien.
Mais en essayant d'ajouter cette barre, mon tableau ce rétrécit et je n'aperçois pas de barre de scroll.
Voici mon code (je n'ai pas d'erreurs) :
Sauver moi SVPP
Merci d'avance
J'ai ajouté une barre de scroll à mon tableau python mais elle ne fonctionne bien
Si j'enlève le code concernant la barre de scroll (de défilement), le tableau est bien.
Mais en essayant d'ajouter cette barre, mon tableau ce rétrécit et je n'aperçois pas de barre de scroll.
Voici mon code (je n'ai pas d'erreurs) :
from tkinter import *
fen = Tk()
fen.geometry('1500x800')
fen.grid()
tableau1 = Frame(fen, width=1100, height=700,)
tableau1.config(background="#45B39D")
tableau1.grid_propagate(0)
tableau1.place(x=10, y=50)
data = [["NOM","Prénom","DS1","TP2","IE4"],["Coef","",4,0.5,1],["frfrf","Bruno",20,14,3],["Hardelepique","Helmut",10,6,"abs"],["NOM","Prénom","DS1","TP2","IE4"],["Coef","",4,0.5,1],["frfrfr","Bruno",20,14,3],["Hardelepique","Helmut",10,6,"abs"],["NOM","Prénom","DS1","TP2","IE4"],["Coef","",4,0.5,1],["frfrfr","Bruno",20,14,3],["Hardelepique","Helmut",10,6,"abs"],["NOM","Prénom","DS1","TP2","IE4"],["Coef","",4,0.5,1],["frfrfrf","Bruno",20,14,3],["Hardelepique","Helmut",10,6,"abs"],["NOM","Prénom","DS1","TP2","IE4"],["Coef","",4,0.5,1],["frfrfr","Bruno",20,14,3],["Hardelepique","Helmut",10,6,"abs"],["NOM","Prénom","DS1","TP2","IE4"],["Coef","",4,0.5,1],["frfrfr","Bruno",20,14,3],["Hardelepique","Helmut",10,6,"abs"],["NOM","Prénom","DS1","TP2","IE4"],["Coef","",4,0.5,1],["frfrfr","Bruno",20,14,3],["Hardelepique","Helmut",10,6,"abs"],["NOM","Prénom","DS1","TP2","IE4"],["Coef","",4,0.5,1],["frfrfr","Bruno",20,14,3],["Hardelepique","Helmut",10,6,"abs"],["NOM","Prénom","DS1","TP2","IE4"],["Coef","",4,0.5,1],["frfrfr","Bruno",20,14,3],["Hardelepique","Helmut",10,6,"abs"]]
class tableau:
def __init__(self, tableau1):
h = Scrollbar(tableau1, orient='horizontal')
h.pack(side=BOTTOM, fill=X)
v = Scrollbar(tableau1)
v.pack(side=RIGHT, fill=Y)
for i in range(total_rows):
for j in range(total_columns):
self.e = Text(tableau1, width=10, height=1.2, fg='blue',font=('Arial',16), xscrollcommand=h.set, yscrollcommand=v.set)
self.e.grid(row=i, column=j)
self.e.insert(END, data[i][j])
self.e.config(state="disabled")
h.config(command=self.e.xview)
v.config(command=self.e.yview)
total_rows = len(data)
total_columns = len(data[0])
tableau(tableau1)
fen.mainloop()
Sauver moi SVPP
Merci d'avance
Configuration: Windows / Chrome 100.0.4896.127