Load TK on demand

This commit is contained in:
henk717 2022-03-06 14:12:01 +01:00
parent daea4b8d15
commit 4835192041
1 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,3 @@
import tkinter as tk
from tkinter import filedialog
from os import getcwd, listdir, path from os import getcwd, listdir, path
from typing import Tuple, Union, Optional from typing import Tuple, Union, Optional
import os import os
@ -10,6 +8,8 @@ import zipfile
# Generic Method for prompting for file path # Generic Method for prompting for file path
#==================================================================# #==================================================================#
def getsavepath(dir, title, types): def getsavepath(dir, title, types):
import tkinter as tk
from tkinter import filedialog
root = tk.Tk() root = tk.Tk()
root.attributes("-topmost", True) root.attributes("-topmost", True)
path = tk.filedialog.asksaveasfile( path = tk.filedialog.asksaveasfile(
@ -28,6 +28,8 @@ def getsavepath(dir, title, types):
# Generic Method for prompting for file path # Generic Method for prompting for file path
#==================================================================# #==================================================================#
def getloadpath(dir, title, types): def getloadpath(dir, title, types):
import tkinter as tk
from tkinter import filedialog
root = tk.Tk() root = tk.Tk()
root.attributes("-topmost", True) root.attributes("-topmost", True)
path = tk.filedialog.askopenfilename( path = tk.filedialog.askopenfilename(
@ -45,6 +47,8 @@ def getloadpath(dir, title, types):
# Generic Method for prompting for directory path # Generic Method for prompting for directory path
#==================================================================# #==================================================================#
def getdirpath(dir, title): def getdirpath(dir, title):
import tkinter as tk
from tkinter import filedialog
root = tk.Tk() root = tk.Tk()
root.attributes("-topmost", True) root.attributes("-topmost", True)
path = filedialog.askdirectory( path = filedialog.askdirectory(