salut,

je débute avec Tkinter et j´aimerai programmer une petite interface qui actionne le lancement d´un programme.
J´y arrive mais j´aimerai y apporter qlqs ajustements,notamment pouvoir creer un "progress bar" qui se déclenche qd le programme est en exécution et qui affiche un message "finish" quand le programme est terminé...

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
 
 
# -*- coding: cp1252 -*-
from Tkinter import*
from PIL import Image, ImageTk
from DCM import*
import Tkinter, tkFileDialog
import os
 
#---------------------function's definition------------------------
 
def creeDialog1():
    """
    create a dialog for the selection of the to be classified files....
    """
    dirname1= tkFileDialog.askdirectory(parent=root,initialdir="/",title='Please select a directory')
    dirInLab=Label(root,text='Infile:'+ dirname1)
    dirInLab.pack()
    return str(dirname1)
 
def creeDialog2():
    """
    create a dialog for the selection of the classification's directory....
    """
    dirname2= tkFileDialog.askdirectory(parent=root,initialdir="/",title='Please select a directory for the classification')
    dirOutLab=Label(root,text='Outfile:'+ dirname2)
    dirOutLab.pack()
    return str(dirname2)
 
def creeWindow():
    """
    create a window with a button'Close'that will be destroy after its release..
    """
    fen=Tk()
    fen.title('Welcome to v1.00')
    tex=Label(fen,text='This the description of....',fg='red')
    tex.pack()
    bou=Button(fen,text='Close',command=fen.destroy)
    bou.pack()
 
def dcm(dirs1,dirs2):
    """
    callback the function Classification from DCM and execute
    this one...
    """
    os.chdir(dirs2)
    Classification(dirs1)
 
 
def test():
    """
    """
    call_Dialog1=creeDialog1()
    call_Dialog2=creeDialog2()
    dcm(call_Dialog1,call_Dialog2)
 
 
 
#---------------------main programm------------------------------
 
if __name__ == '__main__':
 
    root=Tkinter.Tk()
    root.resizable(False,False)
    root.title('Welcome to v1.00')
    image=Image.open('log.png')
    photo=ImageTk.PhotoImage(image)
    Label_photo=Label(root,image=photo).pack(side=RIGHT)
 
    tex1=Label(root,text='This programm....',fg='blue')
    tex1.pack()
 
    tex2=Label(root,text='(c)2009')
    tex2.pack(side=LEFT)
 
    bou1=Button(root,text='Start',background='blue',command=test)
    bou1.pack(side=LEFT)
 
 
    bou2=Button(root,text='Help',background='blue',command=creeWindow)   
    bou2.pack(side=RIGHT)
 
 
    root.mainloop()
mer6 d´avance!

sBugsy