Bonjour,

Je reviens avec un nouveau probléme concernant la mise en place d'une barre de progresion et cette fois si j'ai un message d'erreur:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
 
Traceback (most recent call last):
  File "f:\Chemin\triephoto\main.py", line 20, in <module>
    app = Window(root)
  File "f:\Chemin\triephoto\Interface\Window.py", line 37, in __init__
    labProgressBar = ttk.progressbar(
AttributeError: module 'tkinter.ttk' has no attribute 'progressbar'
voici l'arborescence mon projet :
Racine:
|
|- main.py(programme principal)
|
|-Interface
| |
| |- Window.py (gestion de ma fenêtre principale)
| |- Apropos.py (gestion de la fenetre apropos) qui ne fonctionne pas mais pas urgent
|-lib
| |-Fichiers.py ( fonction pour le traitement que je souhaite réaliser et qui n'est pas encore implementé)

contenus des fichiers:

main.py:

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
# -*- coding=utf-8 -*-
 
from tkinter import *
 
# reprise des import perso
from Interface.Window import Window
 
root = Tk()
screen_width = str(int(root.winfo_screenwidth()/2)-200)
screen_height = str(int(root.winfo_screenheight()/2)-100)
 
app = Window(root)
root.geometry('400x200+'+str(screen_width)+'+'+str(screen_height))
root.title("Trie Photo")
#root.iconbitmap("5139.ico")
 
root.mainloop()
fichier Window.py:

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
# # -*- coding=utf-8 -*-
 
from tkinter import *
from tkinter import filedialog
from tkinter.ttk import *
from PIL import Image as Pil
 
 
 
#import personel
from Lib.Fichiers import Fichiers
from Interface.Apropos import Apropos
 
 
class Window(ttk.Frame):
 
 
    def __init__(self,master=None):
        Frame.__init__(self,master)
        self.master = master
        #self.master['bg']='white'
        self.master
        #a decommenté  dés que l'interface graphique est en place.
        #self.open(True)
 
        # mise en place de la frame principale
        frame1 = ttk.Frame(self,relief='solid')
        # mise en place des zones label
        labOrig = Label(frame1,text="dossier d'origine : ")
        #labOrig.pack()
        labOrig.grid(column=1,row=0)
        labDest = Label(frame1, text="dossier destination : ")
        labDest.grid(column=1,row=1)
        # mise en place de la barre de progression
        labProgress = Label(frame1,text="Progression en cour")
        labProgress.grid(column=1,row=2)
        labProgressBar = ttk.progressbar(
            frame1, orient="HORIZONTAL", length=200, mode='indeterminate')
        #progress = ttk.Progressbar(self, orient="horizontal", length=200, mode="determinate")
        labProgressBar.grid(column=1,row=3)
 
        # mise en place des boutons
        boutonAnnulation = Button(frame1, text="Annuler",command=quit)
        boutonAnnulation.grid(column=0,row=4)
        boutonLancer = Button(frame1, text="Lancer le trie")
        boutonLancer.grid(column=4,row=4)
 
        #Menu
        menu = Menu(self)
        self.master.config(menu=menu)
        file = Menu(menu)
        file.add_command(label='Quitter', command=quit)
        menu.add_cascade(label='Fichier', menu=file)
 
        aide = Menu(menu)
        aide.add_command(label='A propos',command=apropos)
        menu.add_cascade(label='Aide',menu=aide) 
 
        labProgressBar.start(0)
        frame1.grid(row=1,column=1)
        self.grid()
 
    def open(self,start=False):
        orig = filedialog.askdirectory(initialdir=".",
        title="Choissiez le repertoire qui contient les images à traiter!")
        dest = filedialog.askdirectory(initialdir=".",
        title="Choissiez le repertoire destination des images à traiter!")
        self.dossier_Origine = orig
        self.dossier_Destination = dest
 
        if start == False:
            print("je suis dejà selectionné")
 
    def start(self):
        self.progress1["value"] = 0
        self.progress2["value"] = 0
        self.progress1["maximum"] = 5000
        self.progress2["maximum"] = 1000
        self.read_bytes()
#def Apropos():
#
#    fApropos= Tk()
#    # Bouton qui détruit la fenêtre
#    textApropos = Label(fApropos,text='Ce Programme permet de trier automatiquement les fichiers images\n'
#        'venant d\'un dossier spécifié!' )
#    textApropos.pack()
#    bouton = Button(fApropos, text="quitter", command=fApropos.destroy)
#    bouton.pack()        # insère le bouton dans la fenêtre
#    fApropos.mainloop()
 
 
def apropos(self):
        """affiche la fenêtre 'A propos' """
        self.apr = Apropos(self)
        self.apr.focus_set()
fichier apropos.py:
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
#!/usr/bin/python
# -*- coding: utf-8 -*-
 
import tkinter
 
class Apropos(tkinter.Toplevel):
 
    def __init__(self, master=None):
        tkinter.Toplevel.__init__(self, master)
        self.master = master
        self.title("A propos")
 
        self.mes = """
VotreApplication version 1.40
 
Copyright 2018 blablabla...
            """
        police = tkinter.Font(self, size=12, family='Arial')
        self.L = Tkinter.Label(self, text=self.mes,
                               bg='yellow', font=police).grid()
je ne fournis pas fichiers.py.

Avez vous une idée ?