|
14 | 14 | import tk_async_execute as tae |
15 | 15 | import json |
16 | 16 |
|
17 | | - |
18 | | -# Automatically install GUI requirements if GUI is requested to avoid making it an optional dependency |
19 | | -# One other way would be to create a completely different package on pypi for the core daf, but that is a lot of |
20 | | -# work to be done. It is better to auto install. |
21 | | -to_install = [ |
22 | | - ("ttkbootstrap", "==1.10.1"), |
23 | | -] |
24 | | - |
25 | | -version_path = Path.home().joinpath("./gui_versions.json") |
26 | | -if not version_path.exists(): |
27 | | - version_path.touch() |
28 | | - |
29 | | -with open(version_path, "r") as file: |
30 | | - try: |
31 | | - version_data = json.load(file) |
32 | | - except json.JSONDecodeError as exc: |
33 | | - version_data = {} |
34 | | - |
35 | | -for package, version in to_install: |
36 | | - installed_version = version_data.get(package, "0") |
37 | | - if find_spec(package) is None or installed_version != version: |
38 | | - print(f"Auto installing {package}{version}") |
39 | | - subprocess.check_call( |
40 | | - [ |
41 | | - sys.executable.replace("pythonw", "python"), |
42 | | - "-m", "pip", "install", "-U", |
43 | | - package + version |
44 | | - ] |
45 | | - ) |
46 | | - version_data[package] = version |
47 | | - |
48 | | -with open(version_path, "w") as file: |
49 | | - json.dump(version_data, file) |
50 | | - |
51 | | - |
52 | 17 | import ttkbootstrap as ttk |
53 | 18 |
|
54 | 19 | from tkclasswiz.convert import * |
|
0 commit comments