40 lines
1.1 KiB
Python
40 lines
1.1 KiB
Python
import tkinter as tk
|
|
from tkinter import ttk
|
|
import tkinter.messagebox
|
|
|
|
import time # to simulate long-running function
|
|
|
|
from threading import Thread
|
|
|
|
class RedactionSolutions:
|
|
|
|
def __init__(self, master):
|
|
tk.Button(master, text="Run RS Wizard", fg='green', command=self.run).grid(row=5)
|
|
|
|
def long_running_function(self):
|
|
#self.working = tk.Label(root, text='In Progress. Please Wait...')
|
|
self.working = ttk.Progressbar(root, orient='horizontal', mode='determinate')
|
|
self.working.config(value=0, maximum=10)
|
|
self.working.grid(row=6, columnspan=2)
|
|
|
|
for x in range(10):
|
|
print(x)
|
|
self.working.config(value=x)
|
|
time.sleep(1)
|
|
|
|
restart = tkinter.messagebox.askquestion('RS Wizard', 'Redaction complete! See file location for result.\nWould you like to redact another file?')
|
|
if restart == 'yes':
|
|
#self.reset()
|
|
self.working.grid_forget()
|
|
else:
|
|
root.destroy()
|
|
|
|
def run(self):
|
|
Thread(target=self.long_running_function).start()
|
|
|
|
|
|
|
|
root = tk.Tk()
|
|
root.wm_title("RS Wizard")
|
|
RedactionSolutions(root)
|
|
root.mainloop() |