Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- from tkinter import filedialog
- from tkinter import messagebox
- import tkinter as tk, sys, os
- def koniec():
- sys.exit()
- def scan_files(): #skanowanie w poszukiwaniu danego pliku
- cash_file = open('cash_file.txt', 'w')
- print("scaning...\n")
- for root, dirs, files in os.walk('D:/a_phyton_skrypt/test'):
- for file in files:
- if file.endswith('.txt'):
- print(os.path.join('['+file+'] --> '+root, file))
- cash_file.write(os.path.join('['+file+'] --> '+root, file)+'\n')
- print("\nscanned successful!")
- cash_file.close()
- def click():
- entered_text = textentry.get() #Pobieranie danych z pola tekstowego
- print(entered_text)
- def load_list(): #Ładowanie z listy i uruchomienie programu z przycisku
- f = open("cash_file.txt","r")
- tablica = []
- for line in f.readlines():
- tablica.append(line.strip())
- for y in tablica:
- def tst():
- os.popen(y)
- b = tk.Button(main, text = y, command=tst)
- b.pack()
- f.close()
- main = tk.Tk() #GUI
- main.title("Application for Jacob")
- '''
- dir = filedialog.askdirectory()
- print(dir)
- '''
- textentry = tk.Entry(main, width=20, bg="white")
- button4 = tk.Button(main, text="Load List", command=load_list)
- button3 = tk.Button(main, text="Submit", command=click)
- button2 = tk.Button(main, text = "Scan Files", command = scan_files)
- button1 = tk.Button(main, text = "Exit", command = koniec)
- textentry.pack()
- button4.pack()
- button3.pack()
- button2.pack()
- button1.pack()
- main.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement