Chore: Rename tkinter to avoid import issues
This commit is contained in:
parent
3bb1600e62
commit
58fd1ca733
37
mediacopy/tkinterface.py
Normal file
37
mediacopy/tkinterface.py
Normal file
@ -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('<Enter>', 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()
|
Loading…
Reference in New Issue
Block a user