Bonsoir, j'ai un souci d'esthétique avec les grid sur petit écran (15'').
Est-ce que qqn pourrait m'aider à comprendre pourquoi la barre de recherche est énorme ?
Voici mon code :
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
 
import tkinter as tk
from tkinter.scrolledtext import ScrolledText
 
 
cpt = ""
def choisir_dossier ():
    pass
 
def remplir_liste (dossier):
    pass
 
def afficher_fichier (event):
    pass
 
ext=".tex"
def clic(evt):
    pass
 
def recherche(chaine, path, extension):
    pass
 
def recherche_exacte(chaine, path, extension):
    pass
 
def recherche_replace(chaine1, chaine2, path, extension):
    pass
 
def recherche_replace_titre(chaine1, chaine2, path):
    pass
 
def recherche_titre(chaine, path, extension):
    pass
 
def recherche_pdf(chaine, path):
    pass
 
fenetre = tk.Tk()
fenetre.title("Recherche d'une chaîne")
conteneur_fichiers = tk.Frame(fenetre)
 
conteneur_fichiers.columnconfigure(0, weight=1)
conteneur_fichiers.rowconfigure(1, weight=1)
 
tk.Label(
    conteneur_fichiers,
    text="--------------------------------"
).grid(row=0, column=0, sticky=tk.EW)
 
cvar_fichiers = tk.StringVar()
liste_fichiers = tk.Listbox(conteneur_fichiers, listvariable=cvar_fichiers)
liste_fichiers.grid(row=1, column=0, sticky=tk.NS+tk.EW)
 
vbar_fichiers = tk.Scrollbar(conteneur_fichiers, orient=tk.VERTICAL)
vbar_fichiers.grid(row=0, column=1, sticky=tk.NS+tk.EW)
 
liste_fichiers.configure(yscrollcommand=vbar_fichiers.set)
vbar_fichiers.configure(command=liste_fichiers.yview)
 
liste_fichiers.bind("<ButtonRelease-1>", afficher_fichier)
 
tk.Button(
    conteneur_fichiers,
    text="Cliquer ICI pour sélectionner un dossier",
    command=choisir_dossier,
).grid(row=0, column=0)
 
conteneur_fichiers.grid(row=0, column=0, sticky=tk.NS+tk.EW, padx=5, pady=5)
 
conteneur_affichage = tk.Frame(fenetre)
 
conteneur_affichage.columnconfigure(0, weight=1)
conteneur_affichage.rowconfigure(1, weight=1)
 
tk.Label(
    conteneur_affichage,
    text="Présent ici : ",
    bg='light cyan',
).grid(row=0, column=1, sticky=tk.EW)
 
label_ext=tk.Label(fenetre,text="Extension")
label_ext.grid(row=1,column=0,sticky=tk.NS+tk.EW)
l_box = tk.Listbox(fenetre)
l_box.grid(row=1,column=0,sticky=tk.EW)
l_box.bind('<ButtonRelease-1>',clic)  # on associe l'évènement "relachement du bouton gauche la souris" à la listbox
 
label_rech=tk.Label(fenetre,text="A rechercher",font='Helvetica 12 bold', bg='light cyan', fg='blue')
label_rech.grid(row=1,column=1,sticky=tk.NS+tk.EW)
mot = tk.StringVar(fenetre)
mot.set("")
entree = tk.Entry(fenetre, textvariable=mot, bg='light yellow', width=30)
entree.grid(row=2,column=1,sticky=tk.NS+tk.EW)
 
label_rempl=tk.Label(fenetre,text="Remplacer par",font='Helvetica 12 bold', bg='light cyan', fg='red')
label_rempl.grid(row=3,column=1,sticky=tk.NS+tk.EW)
rempl = tk.StringVar(fenetre)
rempl.set("")
entree = tk.Entry(fenetre, textvariable=rempl, bg='light yellow', width=30)
entree.grid(row=4,column=1,sticky=tk.NS+tk.EW)
 
affichage_texte = ScrolledText(
    conteneur_affichage,
    bg="white",
    fg="blue",
    font="sans 9 bold",
    height=8,
    width=70,
)
affichage_texte.grid(row=0, column=2, sticky=tk.NS+tk.EW)
 
tk.Button(
    conteneur_affichage,
    text="Recherche mot dans les contenus",
    font='Helvetica 14 bold', bg='white', fg='blue', activebackground='gray95', activeforeground='green',
    command=lambda: recherche()
).grid(row=5, column=1, sticky=tk.NS+tk.EW)
 
tk.Button(
    conteneur_affichage,
    text="Recherche mot exact dans les contenus",
    font='Helvetica 14 bold', bg='white', fg='blue', activebackground='gray95', activeforeground='green',
    command=lambda: recherche_exacte()
).grid(row=6, column=1, sticky=tk.NS+tk.EW)
 
tk.Button(
    conteneur_affichage,
    text="Recherche mot dans les fichiers pdf",
    font='Helvetica 14 bold', bg='white', fg='blue', activebackground='gray95', activeforeground='green',
    command=lambda: recherche_pdf()
).grid(row=7, column=1, sticky=tk.NS+tk.EW)
 
tk.Button(
    conteneur_affichage,
    text="Recherche mot dans les noms de fichier",
    font='Helvetica 14 bold', bg='white', fg='blue', activebackground='gray95', activeforeground='green',
    command=lambda: recherche_titre()
).grid(row=8, column=1, sticky=tk.NS+tk.EW)
 
tk.Button(
    conteneur_affichage,
    text="Recherche et remplace le mot dans les contenus",
    font='Helvetica 14 bold', bg='white', fg='blue', activebackground='light yellow', activeforeground='red',
    command=lambda: recherche_replace()
).grid(row=8, column=1, sticky=tk.NS+tk.EW)
 
tk.Button(
    conteneur_affichage,
    text="Remplace dans le nom de fichier",
    font='Helvetica 14 bold', bg='white', fg='blue', activebackground='light yellow', activeforeground='red',
    command=lambda: recherche_replace_titre()
).grid(row=9, column=1, sticky=tk.NS+tk.EW)
 
tk.Button(
    conteneur_affichage,
    text="Quitter",
    font='Helvetica 16 bold', bg='white', fg='blue', activebackground='light cyan', activeforeground='red',
    command=fenetre.destroy
).grid(row=11, column=1, sticky=tk.NS+tk.EW)
conteneur_affichage.grid(row=0, column=1, sticky=tk.NS+tk.EW, padx=3, pady=3)
fenetre.rowconfigure(0, weight=1)
fenetre.columnconfigure(1, weight=1)
 
remplir_liste("./")
 
fenetre.mainloop()