From 58fd1ca733cae557f72ccdf091150ec3495040df Mon Sep 17 00:00:00 2001 From: Alexander Hosking Date: Wed, 20 Sep 2023 10:04:48 -0400 Subject: [PATCH] Chore: Rename tkinter to avoid import issues --- mediacopy/tkinterface.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 mediacopy/tkinterface.py diff --git a/mediacopy/tkinterface.py b/mediacopy/tkinterface.py new file mode 100644 index 0000000..1391f72 --- /dev/null +++ b/mediacopy/tkinterface.py @@ -0,0 +1,37 @@ +import tkinter as tk +from tkinter import filedialog +# from tkinter import * + +class Application(tk.Frame): + def __init__(self, master=None): + super().__init__(master) + self.master = master + self.pack() + self.create_widgets() + + def create_widgets(self): + self.copy_from = tk.Button(self) + self.copy_from["text"] = "Copy from..." + # self.copy_from["command"] = self.get_dir(self.copy_from) + self.copy_from.pack(side="top") + + self.copy_to = tk.Button(self) + self.copy_to["text"] = "Copy to..." + # self.copy_to.bind('', self.get_dir(self.copy_to)) + self.copy_to.pack(side="top") + + + self.quit = tk.Button(self, text="QUIT", fg="red", + command=self.master.destroy) + self.quit.pack(side="bottom") + + def get_dir(self, the_widget): + folder_selected = filedialog.askdirectory() + if len(folder_selected) > 6: + the_widget.config(text=folder_selected) + + +root = tk.Tk() +app = Application(master=root) +app.copy_from.configure(command=app.get_dir(app.copy_from)) +app.mainloop() \ No newline at end of file