tksheet 7.4.20__tar.gz → 7.4.22__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {tksheet-7.4.20/tksheet.egg-info → tksheet-7.4.22}/PKG-INFO +1 -1
- {tksheet-7.4.20 → tksheet-7.4.22}/pyproject.toml +1 -1
- {tksheet-7.4.20 → tksheet-7.4.22}/tksheet/__init__.py +1 -1
- {tksheet-7.4.20 → tksheet-7.4.22}/tksheet/functions.py +0 -2
- {tksheet-7.4.20 → tksheet-7.4.22}/tksheet/main_table.py +32 -21
- {tksheet-7.4.20 → tksheet-7.4.22}/tksheet/other_classes.py +40 -10
- {tksheet-7.4.20 → tksheet-7.4.22}/tksheet/sheet.py +35 -38
- {tksheet-7.4.20 → tksheet-7.4.22}/tksheet/top_left_rectangle.py +3 -4
- {tksheet-7.4.20 → tksheet-7.4.22/tksheet.egg-info}/PKG-INFO +1 -1
- {tksheet-7.4.20 → tksheet-7.4.22}/LICENSE.txt +0 -0
- {tksheet-7.4.20 → tksheet-7.4.22}/README.md +0 -0
- {tksheet-7.4.20 → tksheet-7.4.22}/setup.cfg +0 -0
- {tksheet-7.4.20 → tksheet-7.4.22}/tksheet/colors.py +0 -0
- {tksheet-7.4.20 → tksheet-7.4.22}/tksheet/column_headers.py +0 -0
- {tksheet-7.4.20 → tksheet-7.4.22}/tksheet/constants.py +0 -0
- {tksheet-7.4.20 → tksheet-7.4.22}/tksheet/find_window.py +0 -0
- {tksheet-7.4.20 → tksheet-7.4.22}/tksheet/formatters.py +0 -0
- {tksheet-7.4.20 → tksheet-7.4.22}/tksheet/row_index.py +0 -0
- {tksheet-7.4.20 → tksheet-7.4.22}/tksheet/sheet_options.py +0 -0
- {tksheet-7.4.20 → tksheet-7.4.22}/tksheet/sorting.py +0 -0
- {tksheet-7.4.20 → tksheet-7.4.22}/tksheet/text_editor.py +0 -0
- {tksheet-7.4.20 → tksheet-7.4.22}/tksheet/themes.py +0 -0
- {tksheet-7.4.20 → tksheet-7.4.22}/tksheet/tksheet_types.py +0 -0
- {tksheet-7.4.20 → tksheet-7.4.22}/tksheet.egg-info/SOURCES.txt +0 -0
- {tksheet-7.4.20 → tksheet-7.4.22}/tksheet.egg-info/dependency_links.txt +0 -0
- {tksheet-7.4.20 → tksheet-7.4.22}/tksheet.egg-info/top_level.txt +0 -0
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
|
|
6
6
|
name = "tksheet"
|
7
7
|
description = "Tkinter table / sheet and treeview widget"
|
8
8
|
readme = "README.md"
|
9
|
-
version = "7.4.
|
9
|
+
version = "7.4.22"
|
10
10
|
authors = [{ name = "ragardner", email = "github@ragardner.simplelogin.com" }]
|
11
11
|
requires-python = ">=3.8"
|
12
12
|
license = {file = "LICENSE.txt"}
|
@@ -2,7 +2,6 @@ from __future__ import annotations
|
|
2
2
|
|
3
3
|
import csv
|
4
4
|
import io
|
5
|
-
import pickle
|
6
5
|
import re
|
7
6
|
import tkinter as tk
|
8
7
|
from bisect import bisect_left
|
@@ -17,7 +16,6 @@ from .constants import align_value_error, symbols_set
|
|
17
16
|
from .formatters import to_bool
|
18
17
|
from .other_classes import DotDict, EventDataDict, Highlight, Loc, Span
|
19
18
|
|
20
|
-
unpickle_obj = pickle.loads
|
21
19
|
lines_re = re.compile(r"[^\n]+")
|
22
20
|
ORD_A = ord("A")
|
23
21
|
|
@@ -73,7 +73,6 @@ from .functions import (
|
|
73
73
|
len_to_idx,
|
74
74
|
mod_event_val,
|
75
75
|
mod_span,
|
76
|
-
mod_span_widget,
|
77
76
|
move_elements_by_mapping_gen,
|
78
77
|
move_fast,
|
79
78
|
new_tk_event,
|
@@ -83,7 +82,6 @@ from .functions import (
|
|
83
82
|
span_idxs_post_move,
|
84
83
|
stored_event_dict,
|
85
84
|
try_binding,
|
86
|
-
unpickle_obj,
|
87
85
|
wrap_text,
|
88
86
|
)
|
89
87
|
from .other_classes import (
|
@@ -1326,7 +1324,7 @@ class MainTable(tk.Canvas):
|
|
1326
1324
|
and self.input_valid_for_cell(r, datacn, val, ignore_empty=True)
|
1327
1325
|
)
|
1328
1326
|
):
|
1329
|
-
rows[r][datacn] = val
|
1327
|
+
rows[r][datacn] = self.format_value(datarn, datacn, val)
|
1330
1328
|
ctr += 1
|
1331
1329
|
if ctr:
|
1332
1330
|
event_data = self.add_rows(
|
@@ -1376,7 +1374,7 @@ class MainTable(tk.Canvas):
|
|
1376
1374
|
and self.input_valid_for_cell(datarn, c, val, ignore_empty=True)
|
1377
1375
|
)
|
1378
1376
|
):
|
1379
|
-
columns[c][datarn] = val
|
1377
|
+
columns[c][datarn] = self.format_value(datarn, datacn, val)
|
1380
1378
|
ctr += 1
|
1381
1379
|
if ctr:
|
1382
1380
|
event_data = self.add_columns(
|
@@ -1528,7 +1526,7 @@ class MainTable(tk.Canvas):
|
|
1528
1526
|
"displayed": {} if disp_new_idxs is None else disp_new_idxs,
|
1529
1527
|
}
|
1530
1528
|
event_data["options"] = self.copy_options()
|
1531
|
-
event_data["named_spans"] = {k: span.
|
1529
|
+
event_data["named_spans"] = {k: span.copy_self() for k, span in self.named_spans.items()}
|
1532
1530
|
|
1533
1531
|
if move_widths and disp_new_idxs:
|
1534
1532
|
self.set_col_positions(
|
@@ -1787,7 +1785,7 @@ class MainTable(tk.Canvas):
|
|
1787
1785
|
"displayed": {} if disp_new_idxs is None else disp_new_idxs,
|
1788
1786
|
}
|
1789
1787
|
event_data["options"] = self.copy_options()
|
1790
|
-
event_data["named_spans"] = {k: span.
|
1788
|
+
event_data["named_spans"] = {k: span.copy_self() for k, span in self.named_spans.items()}
|
1791
1789
|
|
1792
1790
|
if move_data:
|
1793
1791
|
maxidx = len_to_idx(totalrows)
|
@@ -2081,9 +2079,7 @@ class MainTable(tk.Canvas):
|
|
2081
2079
|
if "tagged_columns" in modification["options"]:
|
2082
2080
|
self.tagged_columns = modification["options"]["tagged_columns"]
|
2083
2081
|
if modification["named_spans"]:
|
2084
|
-
self.named_spans =
|
2085
|
-
k: mod_span_widget(unpickle_obj(v), self.PAR) for k, v in modification["named_spans"].items()
|
2086
|
-
}
|
2082
|
+
self.named_spans = modification["named_spans"]
|
2087
2083
|
if modification["sheet_state"]:
|
2088
2084
|
self.RI.tree_open_ids = modification["sheet_state"]["tree_open_ids"]
|
2089
2085
|
self.row_positions = modification["sheet_state"]["row_positions"]
|
@@ -4792,7 +4788,7 @@ class MainTable(tk.Canvas):
|
|
4792
4788
|
# if there are named spans where columns were added
|
4793
4789
|
# add options to gap which was created by adding columns
|
4794
4790
|
totalrows = None
|
4795
|
-
new_ops = self.PAR.create_options_from_span
|
4791
|
+
new_ops = partial(self.PAR.create_options_from_span, set_data=False)
|
4796
4792
|
qkspan = self.span()
|
4797
4793
|
for span in self.named_spans.values():
|
4798
4794
|
if isinstance(span["from_c"], int):
|
@@ -4855,7 +4851,7 @@ class MainTable(tk.Canvas):
|
|
4855
4851
|
# if there are named spans where rows were added
|
4856
4852
|
# add options to gap which was created by adding rows
|
4857
4853
|
totalcols = None
|
4858
|
-
new_ops = self.PAR.create_options_from_span
|
4854
|
+
new_ops = partial(self.PAR.create_options_from_span, set_data=False)
|
4859
4855
|
qkspan = self.span()
|
4860
4856
|
for span in self.named_spans.values():
|
4861
4857
|
if isinstance(span["from_r"], int):
|
@@ -5123,7 +5119,7 @@ class MainTable(tk.Canvas):
|
|
5123
5119
|
)
|
5124
5120
|
if isinstance(self._headers, list) and header:
|
5125
5121
|
self._headers = insert_items(self._headers, header, self.CH.fix_header)
|
5126
|
-
if push_ops:
|
5122
|
+
if push_ops and columns:
|
5127
5123
|
self.adjust_options_post_add_columns(
|
5128
5124
|
cols=tuple(columns),
|
5129
5125
|
create_ops=create_ops,
|
@@ -5245,7 +5241,7 @@ class MainTable(tk.Canvas):
|
|
5245
5241
|
repeat(default_width, maxcn + 1 - (len(self.col_positions) - 1)),
|
5246
5242
|
)
|
5247
5243
|
)
|
5248
|
-
if push_ops:
|
5244
|
+
if push_ops and rows:
|
5249
5245
|
self.adjust_options_post_add_rows(
|
5250
5246
|
rows=tuple(rows),
|
5251
5247
|
create_ops=create_ops,
|
@@ -5374,11 +5370,16 @@ class MainTable(tk.Canvas):
|
|
5374
5370
|
for datacn, column in enumerate(columns, data_ins_col):
|
5375
5371
|
if column:
|
5376
5372
|
header_dict[datacn] = column[0]
|
5377
|
-
columns_dict[datacn] =
|
5373
|
+
columns_dict[datacn] = {
|
5374
|
+
datarn: self.format_value(datarn, datacn, v)
|
5375
|
+
for datarn, v in enumerate(islice(column, 1, None))
|
5376
|
+
}
|
5378
5377
|
else:
|
5379
5378
|
for datacn, column in enumerate(columns, data_ins_col):
|
5380
5379
|
if column:
|
5381
|
-
columns_dict[datacn] =
|
5380
|
+
columns_dict[datacn] = {
|
5381
|
+
datarn: self.format_value(datarn, datacn, v) for datarn, v in enumerate(column)
|
5382
|
+
}
|
5382
5383
|
|
5383
5384
|
rng = range(displayed_ins_col, displayed_ins_col + len(columns_dict))
|
5384
5385
|
if widths is None:
|
@@ -5418,12 +5419,12 @@ class MainTable(tk.Canvas):
|
|
5418
5419
|
if row:
|
5419
5420
|
index_dict[datarn] = row[0]
|
5420
5421
|
if len(row) > 1:
|
5421
|
-
rows_dict[datarn] = row[1:]
|
5422
|
+
rows_dict[datarn] = [self.format_value(datarn, datacn, v) for datacn, v in enumerate(row[1:])]
|
5422
5423
|
else:
|
5423
5424
|
rows_dict[datarn] = []
|
5424
5425
|
else:
|
5425
5426
|
for datarn, row in enumerate(rows, data_ins_row):
|
5426
|
-
rows_dict[datarn] = row
|
5427
|
+
rows_dict[datarn] = [self.format_value(datarn, datacn, v) for datacn, v in enumerate(row)]
|
5427
5428
|
|
5428
5429
|
rng = range(displayed_ins_row, displayed_ins_row + len(rows_dict))
|
5429
5430
|
if heights is None:
|
@@ -5467,7 +5468,7 @@ class MainTable(tk.Canvas):
|
|
5467
5468
|
if not event_data:
|
5468
5469
|
event_data = self.new_event_dict("delete_columns", state=True)
|
5469
5470
|
event_data["options"] = self.copy_options()
|
5470
|
-
event_data["named_spans"] = {k: span.
|
5471
|
+
event_data["named_spans"] = {k: span.copy_self() for k, span in self.named_spans.items()}
|
5471
5472
|
for i, datacn in enumerate(cols):
|
5472
5473
|
for rn in range(len(self.data)):
|
5473
5474
|
if datacn not in event_data["deleted"]["columns"]:
|
@@ -5557,7 +5558,7 @@ class MainTable(tk.Canvas):
|
|
5557
5558
|
if not event_data:
|
5558
5559
|
event_data = self.new_event_dict("delete_rows", state=True)
|
5559
5560
|
event_data["options"] = self.copy_options()
|
5560
|
-
event_data["named_spans"] = {k: span.
|
5561
|
+
event_data["named_spans"] = {k: span.copy_self() for k, span in self.named_spans.items()}
|
5561
5562
|
|
5562
5563
|
for i, datarn in enumerate(rows):
|
5563
5564
|
event_data["deleted"]["rows"][datarn] = self.data.pop(datarn - i)
|
@@ -5565,7 +5566,6 @@ class MainTable(tk.Canvas):
|
|
5565
5566
|
if self.PAR.ops.treeview:
|
5566
5567
|
event_data["deleted"]["index"] = {datarn: self._row_index[datarn] for datarn in rows}
|
5567
5568
|
event_data = self.RI.tree_del_rows(event_data=event_data)
|
5568
|
-
|
5569
5569
|
elif isinstance(self._row_index, list):
|
5570
5570
|
for i, datarn in enumerate(rows):
|
5571
5571
|
r = datarn - i
|
@@ -8000,6 +8000,17 @@ class MainTable(tk.Canvas):
|
|
8000
8000
|
else:
|
8001
8001
|
self.data[datarn][datacn] = value
|
8002
8002
|
|
8003
|
+
def format_value(self, datarn: int, datacn: int, value: Any) -> Any:
|
8004
|
+
if (datarn, datacn) in self.cell_options and "checkbox" in self.cell_options[(datarn, datacn)]:
|
8005
|
+
return try_to_bool(value)
|
8006
|
+
elif kwargs := self.get_cell_kwargs(datarn, datacn, key="format"):
|
8007
|
+
if kwargs["formatter"] is None:
|
8008
|
+
return format_data(value=value, **kwargs)
|
8009
|
+
else:
|
8010
|
+
return kwargs["formatter"](value, **kwargs)
|
8011
|
+
else:
|
8012
|
+
return value
|
8013
|
+
|
8003
8014
|
def get_value_for_empty_cell(self, datarn: int, datacn: int, r_ops: bool = True, c_ops: bool = True) -> Any:
|
8004
8015
|
kwargs = self.get_cell_kwargs(
|
8005
8016
|
datarn,
|
@@ -8014,7 +8025,7 @@ class MainTable(tk.Canvas):
|
|
8014
8025
|
elif "dropdown" in kwargs and kwargs["dropdown"]["validate_input"] and kwargs["dropdown"]["values"]:
|
8015
8026
|
return kwargs["dropdown"]["values"][0]
|
8016
8027
|
else:
|
8017
|
-
return ""
|
8028
|
+
return self.format_value(datarn, datacn, "")
|
8018
8029
|
|
8019
8030
|
def get_empty_row_seq(
|
8020
8031
|
self, datarn: int, end: int, start: int = 0, r_ops: bool = True, c_ops: bool = True
|
@@ -1,14 +1,11 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
|
-
import
|
3
|
+
import copy
|
4
4
|
import tkinter as tk
|
5
5
|
from collections import namedtuple
|
6
6
|
from collections.abc import Callable, Hashable, Iterator
|
7
|
-
from functools import partial
|
8
7
|
from typing import Any, Literal
|
9
8
|
|
10
|
-
pickle_obj = partial(pickle.dumps, protocol=pickle.HIGHEST_PROTOCOL)
|
11
|
-
|
12
9
|
FontTuple = namedtuple("FontTuple", "family size style")
|
13
10
|
Box_nt = namedtuple(
|
14
11
|
"Box_nt",
|
@@ -423,12 +420,45 @@ class Span(dict):
|
|
423
420
|
cols = self.columns
|
424
421
|
return Box_nt(rows.from_, cols.from_, rows.upto_, cols.upto_)
|
425
422
|
|
426
|
-
def
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
423
|
+
def copy_self(self) -> "Span":
|
424
|
+
# Create a new Span instance
|
425
|
+
span = Span()
|
426
|
+
|
427
|
+
# Iterate over all dictionary items to capture all attributes
|
428
|
+
for key, value in self.items():
|
429
|
+
if key == "widget":
|
430
|
+
# Tkinter widget: retain reference (do not copy)
|
431
|
+
span[key] = value
|
432
|
+
elif key == "kwargs":
|
433
|
+
# Handle kwargs, which may contain functions or lambdas
|
434
|
+
span[key] = {}
|
435
|
+
for k, v in value.items():
|
436
|
+
if callable(v):
|
437
|
+
# Functions/lambdas: shallow copy (immutable, but check for safety)
|
438
|
+
span[key][k] = v
|
439
|
+
else:
|
440
|
+
try:
|
441
|
+
# Deep copy non-callable items in kwargs
|
442
|
+
span[key][k] = copy.deepcopy(v)
|
443
|
+
except Exception:
|
444
|
+
# Handle non-copyable objects (e.g., complex closures or objects)
|
445
|
+
span[key][k] = v # Fallback to shallow copy
|
446
|
+
elif key == "convert" and callable(value):
|
447
|
+
# Convert is a callable: shallow copy (immutable)
|
448
|
+
span[key] = value
|
449
|
+
else:
|
450
|
+
# Deep copy other values to handle nested objects like DotDict
|
451
|
+
try:
|
452
|
+
span[key] = copy.deepcopy(value)
|
453
|
+
except Exception:
|
454
|
+
# Fallback for non-copyable objects
|
455
|
+
span[key] = value # Shallow copy as fallback
|
456
|
+
|
457
|
+
# Ensure widget is set if not already present (edge case)
|
458
|
+
if "widget" not in span and hasattr(self, "widget"):
|
459
|
+
span["widget"] = self["widget"]
|
460
|
+
|
461
|
+
return span
|
432
462
|
|
433
463
|
__setattr__ = __setitem__
|
434
464
|
__getattr__ = __getitem__
|
@@ -954,8 +954,11 @@ class Sheet(tk.Frame):
|
|
954
954
|
self.create_options_from_span(span)
|
955
955
|
return span
|
956
956
|
|
957
|
-
def create_options_from_span(self, span: Span) -> Sheet:
|
958
|
-
|
957
|
+
def create_options_from_span(self, span: Span, set_data: bool = True) -> Sheet:
|
958
|
+
if span.type_ == "format":
|
959
|
+
self.format(span, set_data=set_data, **span.kwargs)
|
960
|
+
else:
|
961
|
+
getattr(self, span.type_)(span, **span.kwargs)
|
959
962
|
return self
|
960
963
|
|
961
964
|
def del_named_span(self, name: str) -> Sheet:
|
@@ -1534,32 +1537,22 @@ class Sheet(tk.Frame):
|
|
1534
1537
|
event_data = set_h(startc, data, event_data)
|
1535
1538
|
# add row/column lines (positions) if required
|
1536
1539
|
if self.MT.all_columns_displayed and maxc >= (ncols := len(self.MT.col_positions) - 1):
|
1537
|
-
|
1538
|
-
|
1539
|
-
displayed_ins_col=len(self.MT.col_positions) - 1,
|
1540
|
-
columns=maxc + 1 - ncols,
|
1541
|
-
widths=None,
|
1542
|
-
headers=False,
|
1543
|
-
)
|
1540
|
+
disp_ins_col, widths_n_cols = len(self.MT.col_positions) - 1, maxc + 1 - ncols
|
1541
|
+
w = self.ops.default_column_width
|
1544
1542
|
event_data = self.MT.add_columns(
|
1545
1543
|
columns={},
|
1546
1544
|
header={},
|
1547
|
-
column_widths=
|
1545
|
+
column_widths=dict(zip(range(disp_ins_col, disp_ins_col + widths_n_cols), repeat(w))),
|
1548
1546
|
event_data=event_data,
|
1549
1547
|
create_selections=False,
|
1550
1548
|
)
|
1551
1549
|
if self.MT.all_rows_displayed and maxr >= (nrows := len(self.MT.row_positions) - 1):
|
1552
|
-
|
1553
|
-
|
1554
|
-
displayed_ins_row=len(self.MT.row_positions) - 1,
|
1555
|
-
rows=maxr + 1 - nrows,
|
1556
|
-
heights=None,
|
1557
|
-
row_index=False,
|
1558
|
-
)
|
1550
|
+
disp_ins_row, heights_n_rows = len(self.MT.row_positions) - 1, maxr + 1 - nrows
|
1551
|
+
h = self.MT.get_default_row_height()
|
1559
1552
|
event_data = self.MT.add_rows(
|
1560
1553
|
rows={},
|
1561
1554
|
index={},
|
1562
|
-
row_heights=
|
1555
|
+
row_heights=dict(zip(range(disp_ins_row, disp_ins_row + heights_n_rows), repeat(h))),
|
1563
1556
|
event_data=event_data,
|
1564
1557
|
create_selections=False,
|
1565
1558
|
)
|
@@ -2580,6 +2573,7 @@ class Sheet(tk.Frame):
|
|
2580
2573
|
formatter_options: dict | None = None,
|
2581
2574
|
formatter_class: Any = None,
|
2582
2575
|
redraw: bool = True,
|
2576
|
+
set_data: bool = True,
|
2583
2577
|
**kwargs,
|
2584
2578
|
) -> Span:
|
2585
2579
|
if formatter_options is None:
|
@@ -2592,36 +2586,39 @@ class Sheet(tk.Frame):
|
|
2592
2586
|
for c in cols:
|
2593
2587
|
self.del_cell_options_checkbox(r, c)
|
2594
2588
|
add_to_options(self.MT.cell_options, (r, c), "format", kwargs)
|
2595
|
-
|
2596
|
-
|
2597
|
-
|
2598
|
-
|
2599
|
-
|
2600
|
-
|
2589
|
+
if set_data:
|
2590
|
+
self.MT.set_cell_data(
|
2591
|
+
r,
|
2592
|
+
c,
|
2593
|
+
value=kwargs["value"] if "value" in kwargs else self.MT.get_cell_data(r, c),
|
2594
|
+
kwargs=kwargs,
|
2595
|
+
)
|
2601
2596
|
elif span.kind == "row":
|
2602
2597
|
for r in rows:
|
2603
2598
|
self.del_row_options_checkbox(r)
|
2604
2599
|
kwargs = fix_format_kwargs(kwargs)
|
2605
2600
|
add_to_options(self.MT.row_options, r, "format", kwargs)
|
2606
|
-
|
2607
|
-
|
2608
|
-
|
2609
|
-
|
2610
|
-
|
2611
|
-
|
2612
|
-
|
2601
|
+
if set_data:
|
2602
|
+
for c in cols:
|
2603
|
+
self.MT.set_cell_data(
|
2604
|
+
r,
|
2605
|
+
c,
|
2606
|
+
value=kwargs["value"] if "value" in kwargs else self.MT.get_cell_data(r, c),
|
2607
|
+
kwargs=kwargs,
|
2608
|
+
)
|
2613
2609
|
elif span.kind == "column":
|
2614
2610
|
for c in cols:
|
2615
2611
|
self.del_column_options_checkbox(c)
|
2616
2612
|
kwargs = fix_format_kwargs(kwargs)
|
2617
2613
|
add_to_options(self.MT.col_options, c, "format", kwargs)
|
2618
|
-
|
2619
|
-
|
2620
|
-
|
2621
|
-
|
2622
|
-
|
2623
|
-
|
2624
|
-
|
2614
|
+
if set_data:
|
2615
|
+
for r in rows:
|
2616
|
+
self.MT.set_cell_data(
|
2617
|
+
r,
|
2618
|
+
c,
|
2619
|
+
value=kwargs["value"] if "value" in kwargs else self.MT.get_cell_data(r, c),
|
2620
|
+
kwargs=kwargs,
|
2621
|
+
)
|
2625
2622
|
self.set_refresh_timer(redraw)
|
2626
2623
|
return span
|
2627
2624
|
|
@@ -4,6 +4,7 @@ import tkinter as tk
|
|
4
4
|
from typing import Any
|
5
5
|
|
6
6
|
from .constants import rc_binding
|
7
|
+
from .functions import try_binding
|
7
8
|
|
8
9
|
|
9
10
|
class TopLeftRectangle(tk.Canvas):
|
@@ -198,10 +199,8 @@ class TopLeftRectangle(tk.Canvas):
|
|
198
199
|
)
|
199
200
|
self.coords(self.select_all_box, 0, 0, w - 5, h - 5)
|
200
201
|
|
201
|
-
def mouse_motion(self, event: Any
|
202
|
-
self.
|
203
|
-
if self.extra_motion_func is not None:
|
204
|
-
self.extra_motion_func(event)
|
202
|
+
def mouse_motion(self, event: Any) -> None:
|
203
|
+
try_binding(self.extra_motion_func, event)
|
205
204
|
|
206
205
|
def b1_press(self, event: Any = None) -> None:
|
207
206
|
self.focus_set()
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|