Skip to content

Commit cca6a26

Browse files
authored
Make tkinter import fail-proof (#390)
* Make tkinter import fail-proof * v0.29.2 * v0.29.2
1 parent 13af6ee commit cca6a26

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
9+
## [0.29.2] - 2025-05-15
810
### Added:
911
- Tree Render: `render_tree` to support drag-and-drop to shift nodes.
12+
### Fixed:
13+
- Tree Render: Make tkinter module import fail-safe.
1014

1115
## [0.29.1] - 2025-05-11
1216
### Added:
@@ -792,7 +796,8 @@ ignore null attribute columns.
792796
- Utility Iterator: Tree traversal methods.
793797
- Workflow To Do App: Tree use case with to-do list implementation.
794798

795-
[Unreleased]: https://github.com/kayjan/bigtree/compare/0.29.1...HEAD
799+
[Unreleased]: https://github.com/kayjan/bigtree/compare/0.29.2...HEAD
800+
[0.29.2]: https://github.com/kayjan/bigtree/compare/0.29.1...0.29.2
796801
[0.29.1]: https://github.com/kayjan/bigtree/compare/0.29.0...0.29.1
797802
[0.29.0]: https://github.com/kayjan/bigtree/compare/0.28.0...0.29.0
798803
[0.28.0]: https://github.com/kayjan/bigtree/compare/0.27.0...0.28.0

bigtree/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.29.1"
1+
__version__ = "0.29.2"
22

33
from bigtree.binarytree.construct import list_to_binarytree
44
from bigtree.dag.construct import dataframe_to_dag, dict_to_dag, list_to_dag

bigtree/tree/construct/render.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1-
import tkinter as tk
2-
from tkinter import ttk
31
from typing import TYPE_CHECKING, Any, Optional
42

53
from bigtree.node import node
64

5+
try:
6+
import tkinter as tk
7+
from tkinter import ttk
8+
except ImportError: # pragma: no cover
9+
from unittest.mock import MagicMock
10+
11+
tk = MagicMock()
12+
ttk = MagicMock()
13+
714
if TYPE_CHECKING:
815
TkEvent = tk.Event[tk.Widget]
916
else:

0 commit comments

Comments
 (0)