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
| # -*- coding: iso-8859-15 -*-
from tkinter import *
import tkinter.ttk as ttk
def add_onglet(ind):
#-- Définition de l'onglet
fr_onglet = Frame(ong,bd =5)
fr_onglet.configure()
ong.add(fr_onglet)
#-- Définition de la fenêtres pour recevoir les lignes
fr_titre =Frame(fr_onglet, bg="pink" ,width=800, height=10)
fr_titre.pack()
fr_sous_titre=Frame(fr_onglet, bg="green" ,width=700, height=10)
fr_sous_titre.pack()
fr_parties =Frame(fr_onglet, bg="yellow" ,width=600, height=300)
#-- Définition du canevas pour porter l'ascenseur
fond=Canvas(fr_parties,width=600, height=300, bg="white")
#-- Définition de l'ascenseur sur le frame fr_parties
s1 = Scrollbar(fr_parties, orient=VERTICAL)
s1.config(command=fond.yview)
fond.config(yscrollcommand=s1.set)
#-- Lignes
ligne=0
for ligne in range(30):
texte="Ligne "+str(ligne)
lig=Label(fond, text =texte, bd=2, bg ="#eaffff", justify=LEFT, width =100, height=1, relief=RIDGE).pack()
s1.pack(side=RIGHT,expand=Y,fill=BOTH)
fond.pack(expand=Y,fill=BOTH)
fr_parties.pack()
#--------------------------------------------------------------------------------------------------------------------------
root=Tk()
root.geometry("800x300+150+150")
root.title("64 lignes")
onglet = ttk.Notebook(root, width=800, height=600)
onglet.pack(expand ="yes" , fill ="both")
ong=onglet
w_nbong=5
i=0
while i < w_nbong:
i=i+1
add_onglet(str(i))
root.mainloop() |
Partager