bonjour,

après plusieurs tentatives infructueuse, pour obtenir des onglets à tailles différentes d'un notebook, j'ai besoin d'aide.
j'ai trouvez ceci écrit avec un classe.
Ne connaissant pas les classes, je souhaite l'écriture simple.

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
55
56
57
58
59
60
61
62
 
 
# coding:utf-8
#version 3.x python
 
from tkinter import *
import tkinter as tk
from tkinter import ttk
 
# ==================================================
#                                  Fenêtre Principal - Configuration
# ==================================================
root = tk.Tk()                                                                                                    # Crée une instance Tk class
root.title("GUI")
root.resizable(False, False)                                                                                 # Fenêtre verrouillée
 
window_height = 800
window_width = 1200
 
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
 
x_cordinate = int((screen_width/2) - (window_width/2))
y_cordinate = int((screen_height/2) - (window_height/2))
 
root.geometry("{}x{}+{}+{}".format(window_width, window_height, x_cordinate, y_cordinate))
 
# ==================================================
#                                  Frames
# ==================================================
 
# --- Frame gauche ---
RightFrame = tk.LabelFrame(root, text="[TEXTE]", font=('verdana', 8, ''), foreground="blue", relief=SOLID, borderwidth=0)
RightFrame.place(x=130, y=5, width=900, height=900)
RightFrame.anchor(anchor="center")
 
# Notebook
style = ttk.Style(RightFrame)
style.configure("PositionOnglet.TNotebook", tabposition="nw")
 
def AutoRisze(notebook):
    print("OK", notebook.winfo_children())
 
    def tab_changed(event):
        print("----------")
        event.widget.update_idletasks()
 
        tab = event.widget.nametowidget(event.widget.select())
        event.widget.configure(height=tab.winfo_reqheight())
 
    notebook.bind("<<NotebookTabChanged>>", lambda event: tab_changed(event))
 
notebook = ttk.Notebook(RightFrame, style="PositionOnglet.TNotebook")               # Création du système d'onglets
 
NB1 = AutoRisze(RightFrame)
 
notebook.add(Frame(NB1, width=400, height=200, name="a"),text="++++++++")
notebook.add(Frame(NB1, width=200, height=400, name="b"),text="-----------")
 
notebook.place(x=5, y=5)
 
root.mainloop()
merci pour l'aide