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
|
#!/usr/bin/env python
import sys, re, string
from Tkinter import *
import tkFileDialog
class Cadre_droite():
def __init__(self, root, zone_text):
frame1 = Frame(root, bg="green", width=300, height=300, padx=10, pady=10)
frame1.pack(side=RIGHT,fill=Y)
self.zone_text = zone_text
self.texte = StringVar()
self.choix1 = Radiobutton(frame1, text='Dos vers Unix', variable=self.texte, value='Dos vers Unix\n', command=self.selection)
self.choix2 = Radiobutton(frame1, text='Unix vers Dos', variable=self.texte, value='Unix vers Dos\n', command=self.selection)
self.choix1.pack()
self.choix2.pack()
self.btnchoixrep = Button(frame1, text='Ouvrir', command = self.choixrep) # boutton choix path
self.btnchoixrep.pack()
def selection(self):
self.zone_text(self.texte.get())
def choixrep(self):
self.rep_courant = tkFileDialog.askdirectory(initialdir="/",title='Choisissez un repertoire')
print self.rep_courant
#Affiche_chemin.set(Rep_courant)
class Cadre_gauche():
def __init__(self, root):
framedroite = Frame(root, bg="white", width=300, height=300, padx=10, pady=10)
framedroite.pack(side=LEFT,fill=Y)
self.txt=Text(framedroite,fg="green",bg="black",width=20,height=50)
self.txt.pack()
def zone_text(self,msg):
self.txt.insert(END,msg)
class Application:
def __init__(self):
self.root = Tk()
self.root.title('Py Dos < == > Unix converter')
def Go(self):
cadre_gauche = Cadre_gauche(self.root)
cadre_droite = Cadre_droite(self.root, cadre_gauche.zone_text)
self.root.mainloop()
if __name__ == '__main__':
app = Application()
app.Go() |