From 4835192041fe580f61f9487bd7b23dbc9be7fc26 Mon Sep 17 00:00:00 2001 From: henk717 Date: Sun, 6 Mar 2022 14:12:01 +0100 Subject: [PATCH] Load TK on demand --- fileops.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fileops.py b/fileops.py index 50f1e94f..5453b04f 100644 --- a/fileops.py +++ b/fileops.py @@ -1,5 +1,3 @@ -import tkinter as tk -from tkinter import filedialog from os import getcwd, listdir, path from typing import Tuple, Union, Optional import os @@ -10,6 +8,8 @@ import zipfile # Generic Method for prompting for file path #==================================================================# def getsavepath(dir, title, types): + import tkinter as tk + from tkinter import filedialog root = tk.Tk() root.attributes("-topmost", True) path = tk.filedialog.asksaveasfile( @@ -28,6 +28,8 @@ def getsavepath(dir, title, types): # Generic Method for prompting for file path #==================================================================# def getloadpath(dir, title, types): + import tkinter as tk + from tkinter import filedialog root = tk.Tk() root.attributes("-topmost", True) path = tk.filedialog.askopenfilename( @@ -45,6 +47,8 @@ def getloadpath(dir, title, types): # Generic Method for prompting for directory path #==================================================================# def getdirpath(dir, title): + import tkinter as tk + from tkinter import filedialog root = tk.Tk() root.attributes("-topmost", True) path = filedialog.askdirectory(