Bonjour,

Étant encore novice sur le langage python, je rencontre un problème sur la génération de bouton avec une image.

En effet lorsque je test en "stand alone" les images apparaissent sur les boutons, si j'intègre dans le projet principale les images n'apparaissent pas.

Si une anomalie est présente ou si vous avez une correction/solution, je suis preneur.

Vous remerciant.

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
 
 
def pilotage():
 
    fpilotage = Tk()
    fpilotage.title("Pilotage")
    fpilotage.resizable(height = None, width = None)
    fpilotage.minsize(width=780, height=500)
    fpilotage.maxsize(width=780, height=500)
 
    #Images motion : 
    droite = PhotoImage(file='png/Droite.png')
    gauche = PhotoImage(file='png/Gauche.png')
    bas = PhotoImage( file='png/Bas.png')
    haut = PhotoImage(file = "png/Haut.png")
    centre = PhotoImage(file='png/Centre.png')
    focus_m = PhotoImage(file='png/Focus-.png')
    focus_p = PhotoImage(file='png/Focus+.png')
    zoom_m = PhotoImage(file='png/Zoom-.png')
    zoom_p = PhotoImage(file='png/Zoom+.png')
 
    fpil_label = Label(fpilotage,font=("Lohit Kannada", 12) ,text = "Caméra : ")
    fpil_label.place(x=10, y=10)
 
    # SPEED
    fpil_frame_s =LabelFrame(fpilotage, text="Speed", padx=00, pady=00, width =60, height =50, relief=FLAT)
    fpil_frame_s.place(x=10.0, y=30.0 )
 
    lfpil_list_speed = ttk.Combobox(fpil_frame_s,values=speed, width=4)
    lfpil_list_speed.place(x=0, y=2 )
    lfpil_list_speed .current(0)
    lfpil_list_speed .bind("<<ComboboxSelected>>")
 
    #*STOP
    fpil_stop = Button(fpilotage, command=stop, text="STOP", relief=FLAT, background= "red",activebackground="red")
    fpil_stop.place(x=10.0, y=80.0 )
 
    # PILOTING CROSS
    fpil_frame_p = LabelFrame(fpilotage, text="", padx=00, pady=00, width =500, height =140, relief=RAISED)
    fpil_frame_p.place(x=80.0, y=40.0 )
    fpil_btn_haut = Button(fpilotage, image=haut, relief=RAISED,command=lambda : cmd("Up", "PtzCtrl")).grid(row=0, column=1)
    fpil_btn_droite = Button(fpil_frame_p, image=droite, relief=FLAT, command=lambda : cmd("Right", "PtzCtrl")).grid(row=2, column=2)
    fpil_btn_centre = Button(fpil_frame_p, image=centre, relief=FLAT).grid(row=2, column=1)
    fpil_btn_gauche = Button(fpil_frame_p, image=gauche, relief=FLAT,command=lambda : cmd("Left", "PtzCtrl")).grid(row=2, column=0)
    fpil_btn_bas = Button(fpil_frame_p, image=bas, relief=FLAT,command=lambda : cmd("Down", "PtzCtrl")).grid(row=3, column=1)
 
 
    # FOCUS/ZOOM
    fpil_frame_zf = LabelFrame(fpilotage, padx=00, pady=00, width =80, height =140, relief=FLAT)
    fpil_frame_zf.place(x=170.0, y=27.0 )
    fpil_frame_z = LabelFrame(fpil_frame_zf, text="Zoom", padx=00, pady=00, relief=FLAT)
    fpil_frame_z.grid(row=1, column=1)#.place(x=180.0, y=30.0 )
    fpil_frame_f = LabelFrame(fpil_frame_zf, text="Focus", padx=00, pady=00, relief=FLAT)
    fpil_frame_f.grid(row=2, column=1)#.place(x=180.0, y=74.0 )
 
    # Zoom
    fpil_btn_zp = Button(fpil_frame_z, image=zoom_p, relief=FLAT,command=lambda : cmd("ZoomInc", "PtzCtrl")).grid(row=1, column=1)
    fpil_btn_zm = Button(fpil_frame_z, image=zoom_m, relief=FLAT,command=lambda : cmd("ZoomDec", "PtzCtrl")).grid(row=1, column=2)
 
    # Focus
    fpil_btn_zp = Button(fpil_frame_f, image=focus_p, relief=FLAT,command=lambda : cmd("FocusInc", "PtzCtrl")).grid(row=1, column=1)
    fpil_btn_zm = Button(fpil_frame_f, image=focus_m, relief=FLAT,command=lambda : cmd("FocusDec", "PtzCtrl")).grid(row=1, column=2)
 
    fpilotage.mainloop()