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
|
# -*- coding: utf-8 -*-
import Tkinter
import tkFileDialog
def choixrep():
rep = tkFileDialog.askdirectory(initialdir="/",title='Choisissez un repertoire')
if len(rep) > 0:
print "vous avez choisi le repertoire %s" % rep
chemin.set('Chemin : '+rep)
fen1 = Tkinter.Tk()
tex1 = Tkinter.Label(fen1, text='Répertoire des sources')
tex1.pack()
btnchoixrep = Tkinter.Button(fen1, text='Votre choix', command = choixrep)
btnchoixrep.pack()
chemin = Tkinter.StringVar()
chemin.set('Chemin : C:/')
lb_rep = Tkinter.Label(fen1, textvariable=chemin)
lb_rep.pack()
btnquitter = Tkinter.Button(fen1, text='Quitter', command = fen1.destroy)
btnquitter.pack()
fen1.mainloop() |