Bonjour,

J'ai réalisé une interface graphique, lors de l'insertation d'une image, un espace se crée entre le bord de la fenetre et les autres boutons.


Comment supprimer cet espace, afin que je puisse positionner mon image dans le coin en haut à droite?
Et aussi coment faire, pour positionner l'ensemble des boutons en dessous de la "ligne" ou se trouve l'image?

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
 
fenetre=Tk()
 
#configuration fenêtre
fenetre.geometry("800x480+10+10")
fenetre.title("Test") # titre de la fenetre
fenetre.minsize(400, 300) # taille minimum de la fenetre
fenetre.maxsize(1024,768) # taille maximum de la fenetre
fenetre.positionfrom("user") # placement manuel de la fenetre
fenetre.sizefrom("user") # dimensionnement manuel de la fenetre
 
#=======Frame 1
frame1=Frame(fenetre, width=60, height=60, padx=10, pady=10)
frame1.grid(row=1, column=2)
 
 
bouton1=Button(frame1,text="bouton1", command= fenetre, padx=10, pady=10, width=10)
bouton1.config(font=('arial', 12, 'bold'))
bouton1.grid(row=1, column=1)
 
 
bouton2=Button(frame1,text="bouton2", command= fenetre, padx=10, pady=10, width=10)
bouton2.config(font=('arial', 12, 'bold'))
bouton2.grid(row=1, column=2)
 
 
bouton3=Button(frame1,text="bouton3", command= fenetre, padx=10, pady=10, width=10)
bouton3.config(font=('arial', 12, 'bold'))
bouton3.grid(row=2, column=1)
valueADC=StringVar()
label9=Label(frame1, textvariable=valueADC, width=12, height=2)
label9.config(font=('arial', 15, 'bold'))
label9.grid(row=2, column=2)
#label9.config(text=valueADC)
 
#=======Frame 2
frame2=Frame(fenetre, width=60, height=60, padx=10, pady=10)
frame2.grid(row=1, column=3)
 
bouton3=Button(frame2,text="bouton4", command= fenetre, padx=10, pady=10, width=10)
bouton3.config(font=('arial', 12, 'bold'))
bouton3.grid(row=1, column=1)
 
 
bouton4=Button(frame2,text="bouton5", command= fenetre, padx=10, pady=10, width=10)
bouton4.config(font=('arial', 12, 'bold'))
bouton4.grid(row=1, column=2)
 
 
bouton3=Button(frame2,text="bouton6", command= fenetre, padx=10, pady=10, width=10)
bouton3.config(font=('arial', 12, 'bold'))
bouton3.grid(row=2, column=1)
 
 
bouton4=Button(frame2,text="bouton7", command= fenetre, padx=10, pady=10, width=10)
bouton4.config(font=('arial', 12, 'bold'))
bouton4.grid(row=2, column=2)
 
 
#Date-------------------------------
heure = StringVar()
#label4=Label(fenetre, text="Date:")
#label4.grid(row=1, column=1)
label5=Label(fenetre, textvariable=heure)
label5.grid(row=0, column=2)
timer_date()
 
photo = PhotoImage(file="Exemple.GIF")
canvas = Canvas(fenetre, width=350, height=200)
canvas.create_image(50, 50, image=photo )
canvas.grid(row=1, column=4, sticky=N)
 
#=======Frame 3
frame3=Frame(fenetre, width=60, height=60, padx=10, pady=10)
frame3.grid(row=2, column=2, columnspan=2)
 
 
#Bouton quitter
bouton4=Button(frame3,text="Quitter", command=fenetre.destroy,width=10, height=2, padx=10, pady=10)
bouton4.config(font=('arial', 12, 'bold'))
bouton4.grid(row=1,column=1)
 
fenetre.mainloop()

Note: je n'ai pas réussi à insérer la capture de mon interface, dans ce message.

En vous remerciant.

Cordialement.