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
|
#! /usr/bin/python
#_*_ coding:utf-8 _*_
from tkinter import *
from tkinter.messagebox import * # boîte de dialogue
from tkinter.commondialog import Dialog
from PySide import QtGui
from PySide.QtGui import QApplication
import os, sys,subprocess
class MainWindow(QtGui.QMainWindow):
def __init__(self):
super(MainWindow, self).__init__()
* INIT VARIABLE
* CREATION DU RAPPORT
repertoires = windows
# Fonction de recherche fichier
def recherche():
listFic.insert(END,"Traitement en cours ....") -----------------> NE S'AFFICHE PAS au lancement
FOR ............. PARTIE DU CODE SI TROUVE
en fin de traitement la liste box s'affiche avec celle qui n'est pas afficher au dépard
# Si pas trouvé insert non trouvé
partie du code si recherche négative
def rapport():
# Ouverture du rapport dans bloc note
xfic = ("Rapport_find.txt")
subprocess.call(['notepad.exe',xfic],shell=True)
# ####################
# programme principal
# ####################
# Fenetre principale
fenetre = Tk()
fenetre.title("Recherche ")
fenetre.geometry('900x220+200+300')
# Fenetre secondaire
fen_canvas = Canvas(fenetre,bg='white',borderwidth=4,relief=RIDGE,height=400,width=450)
fen_canvas.pack(side=LEFT)
# Scrolling fenetre secondaire
scrollbar = Scrollbar(fen_canvas,bg='blue',orient=VERTICAL)
scrollbar.pack( side = RIGHT, fill=Y )
listFic = Listbox(fen_canvas,background = 'ghost white', yscrollcommand = scrollbar.set )
listFic.pack( side = LEFT, fill = BOTH, ipadx=260, ipady=100, padx=30, pady=50 )
scrollbar.config( command = listFic.yview )
# Label et Zone de saisie
LabelTxt = Label(fenetre,text=" Nom du fichier à rechercher ",bg="Silver",relief="groove",borderwidth=3)
search=StringVar()
Saisie = Entry(fenetre,width=40, relief="groove", bd=5, bg="white", textvariable=search)
LabelTxt.pack(expand=True)
Saisie.pack(expand=True)
# Photo insérée dans fenetre principale
photo=PhotoImage(file="2014-06-02_192814.gif")
pagegarde = Label(fenetre, image=photo)
pagegarde.pack(expand=True)
# Bouton
validation = Button(fenetre,text='Validation',fg='black',command = recherche, relief="groove",borderwidth=5).pack(side=RIGHT)
rapport = Button(fenetre,text='Rapport',fg='black',command = rapport, relief="groove",borderwidth=5).pack(side=RIGHT)
Quitter = Button(fenetre,text='Quitter',fg='black',command = fenetre.destroy, relief="groove",borderwidth=5).pack(side=RIGHT)
fen_canvas.mainloop()
fenetre.mainloop()
if __name__ == '__main__':
window = MainWindow()
window.show()
sys.exit(app.exec_()) |
Partager