tksheet 7.2.22__tar.gz → 7.3.0__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.
Files changed (25) hide show
  1. {tksheet-7.2.22/tksheet.egg-info → tksheet-7.3.0}/PKG-INFO +36 -12
  2. {tksheet-7.2.22 → tksheet-7.3.0}/README.md +34 -11
  3. {tksheet-7.2.22 → tksheet-7.3.0}/pyproject.toml +2 -1
  4. {tksheet-7.2.22 → tksheet-7.3.0}/tksheet/__init__.py +1 -1
  5. {tksheet-7.2.22 → tksheet-7.3.0}/tksheet/column_headers.py +48 -62
  6. {tksheet-7.2.22 → tksheet-7.3.0}/tksheet/functions.py +22 -4
  7. {tksheet-7.2.22 → tksheet-7.3.0}/tksheet/main_table.py +118 -93
  8. {tksheet-7.2.22 → tksheet-7.3.0}/tksheet/other_classes.py +14 -13
  9. {tksheet-7.2.22 → tksheet-7.3.0}/tksheet/row_index.py +46 -62
  10. {tksheet-7.2.22 → tksheet-7.3.0}/tksheet/sheet.py +84 -43
  11. {tksheet-7.2.22 → tksheet-7.3.0}/tksheet/sheet_options.py +6 -72
  12. {tksheet-7.2.22 → tksheet-7.3.0}/tksheet/text_editor.py +11 -0
  13. tksheet-7.3.0/tksheet/themes.py +412 -0
  14. {tksheet-7.2.22 → tksheet-7.3.0}/tksheet/top_left_rectangle.py +14 -7
  15. {tksheet-7.2.22 → tksheet-7.3.0}/tksheet/vars.py +4 -1
  16. {tksheet-7.2.22 → tksheet-7.3.0/tksheet.egg-info}/PKG-INFO +36 -12
  17. tksheet-7.2.22/tksheet/themes.py +0 -342
  18. {tksheet-7.2.22 → tksheet-7.3.0}/LICENSE.txt +0 -0
  19. {tksheet-7.2.22 → tksheet-7.3.0}/setup.cfg +0 -0
  20. {tksheet-7.2.22 → tksheet-7.3.0}/tksheet/colors.py +0 -0
  21. {tksheet-7.2.22 → tksheet-7.3.0}/tksheet/formatters.py +0 -0
  22. {tksheet-7.2.22 → tksheet-7.3.0}/tksheet/types.py +0 -0
  23. {tksheet-7.2.22 → tksheet-7.3.0}/tksheet.egg-info/SOURCES.txt +0 -0
  24. {tksheet-7.2.22 → tksheet-7.3.0}/tksheet.egg-info/dependency_links.txt +0 -0
  25. {tksheet-7.2.22 → tksheet-7.3.0}/tksheet.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tksheet
3
- Version: 7.2.22
3
+ Version: 7.3.0
4
4
  Summary: Tkinter table / sheet widget
5
5
  Author-email: ragardner <github@ragardner.simplelogin.com>
6
6
  License: Copyright (c) 2019 ragardner and open source contributors
@@ -36,12 +36,14 @@ Classifier: Programming Language :: Python :: 3.9
36
36
  Classifier: Programming Language :: Python :: 3.10
37
37
  Classifier: Programming Language :: Python :: 3.11
38
38
  Classifier: Programming Language :: Python :: 3.12
39
+ Classifier: Programming Language :: Python :: 3.13
39
40
  Requires-Python: >=3.8
40
41
  Description-Content-Type: text/markdown
41
42
  License-File: LICENSE.txt
42
43
 
43
44
  <p align="center" width="100%">
44
- <img width="33%" src="https://github.com/ragardner/tksheet/assets/26602401/4124c3ce-cf62-4925-9158-c5bdf712765b">
45
+ <img width="45%" src="https://github.com/user-attachments/assets/4afc1783-6461-4b98-93cb-b2a2a7f35169" alt="tksheet table">
46
+ <img width="45%"src="https://github.com/user-attachments/assets/08e77e89-00ea-4c52-9222-9bd421284360" alt="tksheet treeview">
45
47
  </p>
46
48
 
47
49
  # <div align="center">tksheet - python tkinter table widget</div>
@@ -50,14 +52,35 @@ License-File: LICENSE.txt
50
52
 
51
53
  [![GitHub Release Date](https://img.shields.io/github/release-date-pre/ragardner/tksheet.svg)](https://github.com/ragardner/tksheet/releases) [![Downloads](https://img.shields.io/pypi/dm/tksheet.svg)](https://pypi.org/project/tksheet/)
52
54
 
53
- | **Help** | |
54
- |-------------------|------------------------------------------------------------------|
55
- | Versions 6.x.x -> | [Documentation Wiki](https://github.com/ragardner/tksheet/wiki/Version-6) | |
56
- | Versions 7.x.x -> | [Documentation Wiki](https://github.com/ragardner/tksheet/wiki/Version-7) | |
57
- | [Changelog](https://github.com/ragardner/tksheet/blob/master/docs/CHANGELOG.md) | |
58
- | [Questions](https://github.com/ragardner/tksheet/wiki/Version-7#asking-questions) | |
59
- | [Issues](https://github.com/ragardner/tksheet/wiki/Version-7#issues) | |
60
- | [Suggestions](https://github.com/ragardner/tksheet/wiki/Version-7#enhancements-or-suggestions) | |
55
+ <table>
56
+ <thead>
57
+ <tr>
58
+ <th style="color: lightgreen" colspan=2><strong>Help</strong></th>
59
+ </tr>
60
+ </thead>
61
+ <tbody>
62
+ <tr>
63
+ <td style="color: LightCoral">Versions 6.x.x &#8594;</td>
64
+ <td><a href="https://github.com/ragardner/tksheet/wiki/Version-6">Documentation Wiki</a></td>
65
+ </tr>
66
+ <tr>
67
+ <td style="color: lightgreen">Versions 7.x.x &#8594;</td>
68
+ <td><a href="https://github.com/ragardner/tksheet/wiki/Version-7">Documentation Wiki</a></td>
69
+ </tr>
70
+ <tr>
71
+ <td align="right" colspan="2"><a href="https://github.com/ragardner/tksheet/blob/master/docs/CHANGELOG.md">Changelog</a></td>
72
+ </tr>
73
+ <tr>
74
+ <td align="right" colspan="2"><a href="https://github.com/ragardner/tksheet/wiki/Version-7#asking-questions">Questions</a></td>
75
+ </tr>
76
+ <tr>
77
+ <td align="right" colspan="2"><a href="https://github.com/ragardner/tksheet/wiki/Version-7#issues">Issues</a></td>
78
+ </tr>
79
+ <tr>
80
+ <td align="right" colspan="2"><a href="https://github.com/ragardner/tksheet/wiki/Version-7#enhancements-or-suggestions">Suggestions</a></td>
81
+ </tr>
82
+ </tbody>
83
+ </table>
61
84
 
62
85
  This library is maintained with the help of **[others](https://github.com/ragardner/tksheet/graphs/contributors)**. If you would like to contribute please read this [help section](https://github.com/ragardner/tksheet/wiki/Version-7#contributing).
63
86
 
@@ -82,8 +105,10 @@ This library is maintained with the help of **[others](https://github.com/ragard
82
105
  - Expand row heights and column widths
83
106
  - Change fonts and font size (not for individual cells)
84
107
  - Change any colors in the sheet
85
- - Dropdowns, check boxes, progress bars
86
108
  - [Treeview mode](https://github.com/ragardner/tksheet/wiki/Version-7#treeview-mode)
109
+ - [Dropdown boxes](https://github.com/ragardner/tksheet/wiki/Version-7#dropdown-boxes)
110
+ - [Check boxes](https://github.com/ragardner/tksheet/wiki/Version-7#check-boxes)
111
+ - [Progress bars](https://github.com/ragardner/tksheet/wiki/Version-7#progress-bars)
87
112
  - [Hide rows and/or columns](https://github.com/ragardner/tksheet/wiki/Version-7#example-header-dropdown-boxes-and-row-filtering)
88
113
  - Left `"w"`, Center `"center"` or Right `"e"` text alignment for any cell/row/column
89
114
 
@@ -117,4 +142,3 @@ sheet.delete_columns(columns=[0, 3], undo=True)
117
142
  ![tksheet treeview](https://github.com/user-attachments/assets/159ab987-7612-4db7-98de-1f30c9680247)
118
143
 
119
144
 
120
-
@@ -1,5 +1,6 @@
1
1
  <p align="center" width="100%">
2
- <img width="33%" src="https://github.com/ragardner/tksheet/assets/26602401/4124c3ce-cf62-4925-9158-c5bdf712765b">
2
+ <img width="45%" src="https://github.com/user-attachments/assets/4afc1783-6461-4b98-93cb-b2a2a7f35169" alt="tksheet table">
3
+ <img width="45%"src="https://github.com/user-attachments/assets/08e77e89-00ea-4c52-9222-9bd421284360" alt="tksheet treeview">
3
4
  </p>
4
5
 
5
6
  # <div align="center">tksheet - python tkinter table widget</div>
@@ -8,14 +9,35 @@
8
9
 
9
10
  [![GitHub Release Date](https://img.shields.io/github/release-date-pre/ragardner/tksheet.svg)](https://github.com/ragardner/tksheet/releases) [![Downloads](https://img.shields.io/pypi/dm/tksheet.svg)](https://pypi.org/project/tksheet/)
10
11
 
11
- | **Help** | |
12
- |-------------------|------------------------------------------------------------------|
13
- | Versions 6.x.x -> | [Documentation Wiki](https://github.com/ragardner/tksheet/wiki/Version-6) | |
14
- | Versions 7.x.x -> | [Documentation Wiki](https://github.com/ragardner/tksheet/wiki/Version-7) | |
15
- | [Changelog](https://github.com/ragardner/tksheet/blob/master/docs/CHANGELOG.md) | |
16
- | [Questions](https://github.com/ragardner/tksheet/wiki/Version-7#asking-questions) | |
17
- | [Issues](https://github.com/ragardner/tksheet/wiki/Version-7#issues) | |
18
- | [Suggestions](https://github.com/ragardner/tksheet/wiki/Version-7#enhancements-or-suggestions) | |
12
+ <table>
13
+ <thead>
14
+ <tr>
15
+ <th style="color: lightgreen" colspan=2><strong>Help</strong></th>
16
+ </tr>
17
+ </thead>
18
+ <tbody>
19
+ <tr>
20
+ <td style="color: LightCoral">Versions 6.x.x &#8594;</td>
21
+ <td><a href="https://github.com/ragardner/tksheet/wiki/Version-6">Documentation Wiki</a></td>
22
+ </tr>
23
+ <tr>
24
+ <td style="color: lightgreen">Versions 7.x.x &#8594;</td>
25
+ <td><a href="https://github.com/ragardner/tksheet/wiki/Version-7">Documentation Wiki</a></td>
26
+ </tr>
27
+ <tr>
28
+ <td align="right" colspan="2"><a href="https://github.com/ragardner/tksheet/blob/master/docs/CHANGELOG.md">Changelog</a></td>
29
+ </tr>
30
+ <tr>
31
+ <td align="right" colspan="2"><a href="https://github.com/ragardner/tksheet/wiki/Version-7#asking-questions">Questions</a></td>
32
+ </tr>
33
+ <tr>
34
+ <td align="right" colspan="2"><a href="https://github.com/ragardner/tksheet/wiki/Version-7#issues">Issues</a></td>
35
+ </tr>
36
+ <tr>
37
+ <td align="right" colspan="2"><a href="https://github.com/ragardner/tksheet/wiki/Version-7#enhancements-or-suggestions">Suggestions</a></td>
38
+ </tr>
39
+ </tbody>
40
+ </table>
19
41
 
20
42
  This library is maintained with the help of **[others](https://github.com/ragardner/tksheet/graphs/contributors)**. If you would like to contribute please read this [help section](https://github.com/ragardner/tksheet/wiki/Version-7#contributing).
21
43
 
@@ -40,8 +62,10 @@ This library is maintained with the help of **[others](https://github.com/ragard
40
62
  - Expand row heights and column widths
41
63
  - Change fonts and font size (not for individual cells)
42
64
  - Change any colors in the sheet
43
- - Dropdowns, check boxes, progress bars
44
65
  - [Treeview mode](https://github.com/ragardner/tksheet/wiki/Version-7#treeview-mode)
66
+ - [Dropdown boxes](https://github.com/ragardner/tksheet/wiki/Version-7#dropdown-boxes)
67
+ - [Check boxes](https://github.com/ragardner/tksheet/wiki/Version-7#check-boxes)
68
+ - [Progress bars](https://github.com/ragardner/tksheet/wiki/Version-7#progress-bars)
45
69
  - [Hide rows and/or columns](https://github.com/ragardner/tksheet/wiki/Version-7#example-header-dropdown-boxes-and-row-filtering)
46
70
  - Left `"w"`, Center `"center"` or Right `"e"` text alignment for any cell/row/column
47
71
 
@@ -75,4 +99,3 @@ sheet.delete_columns(columns=[0, 3], undo=True)
75
99
  ![tksheet treeview](https://github.com/user-attachments/assets/159ab987-7612-4db7-98de-1f30c9680247)
76
100
 
77
101
 
78
-
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
6
6
  name = "tksheet"
7
7
  description = "Tkinter table / sheet widget"
8
8
  readme = "README.md"
9
- version = "7.2.22"
9
+ version = "7.3.0"
10
10
  authors = [{ name = "ragardner", email = "github@ragardner.simplelogin.com" }]
11
11
  requires-python = ">=3.8"
12
12
  license = {file = "LICENSE.txt"}
@@ -21,6 +21,7 @@ classifiers = [
21
21
  "Programming Language :: Python :: 3.10",
22
22
  "Programming Language :: Python :: 3.11",
23
23
  "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3.13",
24
25
  ]
25
26
 
26
27
  [project.urls]
@@ -4,7 +4,7 @@
4
4
  tksheet - A Python tkinter table widget
5
5
  """
6
6
 
7
- __version__ = "7.2.22"
7
+ __version__ = "7.3.0"
8
8
 
9
9
  from .colors import (
10
10
  color_map,
@@ -61,7 +61,7 @@ class ColumnHeaders(tk.Canvas):
61
61
  highlightthickness=0,
62
62
  )
63
63
  self.PAR = kwargs["parent"]
64
- self.current_height = None # is set from within MainTable() __init__ or from Sheet parameters
64
+ self.current_height = None
65
65
  self.MT = None # is set from within MainTable() __init__
66
66
  self.RI = None # is set from within MainTable() __init__
67
67
  self.TL = None # is set from within TopLeftRectangle() __init__
@@ -101,7 +101,6 @@ class ColumnHeaders(tk.Canvas):
101
101
  self.cell_options = {}
102
102
  self.rsz_w = None
103
103
  self.rsz_h = None
104
- self.new_col_height = 0
105
104
  self.lines_start_at = 0
106
105
  self.currently_resizing_width = False
107
106
  self.currently_resizing_height = False
@@ -191,14 +190,17 @@ class ColumnHeaders(tk.Canvas):
191
190
  self.lines_start_at -= 1
192
191
  self.MT.main_table_redraw_grid_and_text(redraw_header=True, redraw_row_index=False, redraw_table=False)
193
192
 
194
- def set_height(self, new_height: int, set_TL: bool = False) -> None:
195
- self.current_height = new_height
193
+ def set_height(self, new_height: int, set_TL: bool = False) -> bool:
196
194
  try:
197
195
  self.config(height=new_height)
198
196
  except Exception:
199
- return
197
+ return False
200
198
  if set_TL and self.TL is not None:
201
199
  self.TL.set_dimensions(new_h=new_height)
200
+ if expanded := isinstance(self.current_height, int) and new_height > self.current_height:
201
+ self.MT.recreate_all_selection_boxes()
202
+ self.current_height = new_height
203
+ return expanded
202
204
 
203
205
  def rc(self, event: object) -> None:
204
206
  self.mouseclick_outside_editor_or_dropdown_all_canvases(inside=True)
@@ -471,12 +473,7 @@ class ColumnHeaders(tk.Canvas):
471
473
  )
472
474
  self.MT.create_resize_line(line2x, y1, line2x, y2, width=1, fill=self.PAR.ops.resizing_line_fg, tag="rwl2")
473
475
  elif self.height_resizing_enabled and self.rsz_w is None and self.rsz_h is not None:
474
- x1, y1, x2, y2 = self.MT.get_canvas_visible_area()
475
476
  self.currently_resizing_height = True
476
- y = event.y
477
- if y < self.MT.min_header_height:
478
- y = int(self.MT.min_header_height)
479
- self.new_col_height = y
480
477
  elif self.MT.identify_col(x=event.x, allow_end=False) is None:
481
478
  self.MT.deselect("all")
482
479
  elif self.col_selection_enabled and self.rsz_w is None and self.rsz_h is None:
@@ -504,7 +501,7 @@ class ColumnHeaders(tk.Canvas):
504
501
  if self.width_resizing_enabled and self.rsz_w is not None and self.currently_resizing_width:
505
502
  x = self.canvasx(event.x)
506
503
  size = x - self.MT.col_positions[self.rsz_w - 1]
507
- if size >= self.MT.min_column_width and size < self.MT.max_column_width:
504
+ if size >= self.PAR.ops.min_column_width and size < self.PAR.ops.max_column_width:
508
505
  self.hide_resize_and_ctrl_lines(ctrl_lines=False)
509
506
  line2x = self.MT.col_positions[self.rsz_w - 1]
510
507
  self.create_resize_line(
@@ -539,17 +536,13 @@ class ColumnHeaders(tk.Canvas):
539
536
  elif self.height_resizing_enabled and self.rsz_h is not None and self.currently_resizing_height:
540
537
  evy = event.y
541
538
  if evy > self.current_height:
542
- y = self.MT.canvasy(evy - self.current_height)
543
- if evy > self.MT.max_header_height:
544
- evy = int(self.MT.max_header_height)
545
- y = self.MT.canvasy(evy - self.current_height)
546
- self.new_col_height = evy
539
+ if evy > self.PAR.ops.max_header_height:
540
+ evy = int(self.PAR.ops.max_header_height)
541
+ self.drag_height_resize(evy)
547
542
  else:
548
- y = evy
549
- if y < self.MT.min_header_height:
550
- y = int(self.MT.min_header_height)
551
- self.new_col_height = y
552
- self.drag_height_resize()
543
+ if evy < self.MT.min_header_height:
544
+ evy = int(self.MT.min_header_height)
545
+ self.drag_height_resize(evy)
553
546
  elif (
554
547
  self.drag_and_drop_enabled
555
548
  and self.col_selection_enabled
@@ -596,9 +589,9 @@ class ColumnHeaders(tk.Canvas):
596
589
  self.MT.main_table_redraw_grid_and_text(redraw_header=True, redraw_row_index=False)
597
590
  try_binding(self.extra_b1_motion_func, event)
598
591
 
599
- def drag_height_resize(self) -> None:
600
- self.set_height(self.new_col_height, set_TL=True)
601
- self.MT.main_table_redraw_grid_and_text(redraw_header=True, redraw_row_index=True)
592
+ def drag_height_resize(self, height: int) -> None:
593
+ if self.set_height(height, set_TL=True):
594
+ self.MT.main_table_redraw_grid_and_text(redraw_header=True, redraw_row_index=False, redraw_table=False)
602
595
 
603
596
  def get_b1_motion_box(self, start_col: int, end_col: int) -> tuple[int, int, int, int, Literal["columns"]]:
604
597
  if end_col >= start_col:
@@ -781,10 +774,10 @@ class ColumnHeaders(tk.Canvas):
781
774
  new_col_pos = int(self.coords("rwl")[0])
782
775
  old_width = self.MT.col_positions[self.rsz_w] - self.MT.col_positions[self.rsz_w - 1]
783
776
  size = new_col_pos - self.MT.col_positions[self.rsz_w - 1]
784
- if size < self.MT.min_column_width:
785
- new_col_pos = ceil(self.MT.col_positions[self.rsz_w - 1] + self.MT.min_column_width)
786
- elif size > self.MT.max_column_width:
787
- new_col_pos = floor(self.MT.col_positions[self.rsz_w - 1] + self.MT.max_column_width)
777
+ if size < self.PAR.ops.min_column_width:
778
+ new_col_pos = ceil(self.MT.col_positions[self.rsz_w - 1] + self.PAR.ops.min_column_width)
779
+ elif size > self.PAR.ops.max_column_width:
780
+ new_col_pos = floor(self.MT.col_positions[self.rsz_w - 1] + self.PAR.ops.max_column_width)
788
781
  increment = new_col_pos - self.MT.col_positions[self.rsz_w]
789
782
  self.MT.col_positions[self.rsz_w + 1 :] = [
790
783
  e + increment for e in islice(self.MT.col_positions, self.rsz_w + 1, None)
@@ -804,27 +797,22 @@ class ColumnHeaders(tk.Canvas):
804
797
  )
805
798
 
806
799
  def b1_release(self, event: object) -> None:
800
+ to_hide = self.being_drawn_item
807
801
  if self.being_drawn_item is not None and (to_sel := self.MT.coords_and_type(self.being_drawn_item)):
808
802
  r_to_sel, c_to_sel = self.MT.selected.row, self.MT.selected.column
809
- self.MT.hide_selection_box(self.being_drawn_item)
803
+ self.being_drawn_item = None
810
804
  self.MT.set_currently_selected(
811
805
  r_to_sel,
812
806
  c_to_sel,
813
807
  item=self.MT.create_selection_box(*to_sel, set_current=False),
808
+ run_binding=False,
814
809
  )
815
- sel_event = self.MT.get_select_event(being_drawn_item=self.being_drawn_item)
816
- try_binding(self.drag_selection_binding_func, sel_event)
817
- self.PAR.emit_event("<<SheetSelect>>", data=sel_event)
818
- else:
819
- self.being_drawn_item = None
810
+ self.MT.hide_selection_box(to_hide)
820
811
  self.MT.bind("<MouseWheel>", self.MT.mousewheel)
821
812
  if self.width_resizing_enabled and self.rsz_w is not None and self.currently_resizing_width:
822
813
  self.drag_width_resize()
823
814
  self.currently_resizing_width = False
824
815
  self.hide_resize_and_ctrl_lines(ctrl_lines=False)
825
- elif self.height_resizing_enabled and self.rsz_h is not None and self.currently_resizing_height:
826
- self.currently_resizing_height = False
827
- self.drag_height_resize()
828
816
  elif (
829
817
  self.drag_and_drop_enabled
830
818
  and self.col_selection_enabled
@@ -1021,7 +1009,7 @@ class ColumnHeaders(tk.Canvas):
1021
1009
  w = b[2] - b[0] + 7
1022
1010
  h = b[3] - b[1] + 5
1023
1011
  else:
1024
- w = self.MT.min_column_width
1012
+ w = self.PAR.ops.min_column_width
1025
1013
  h = self.MT.min_header_height
1026
1014
  if datacn in self.cell_options and (
1027
1015
  self.get_cell_kwargs(datacn, key="dropdown") or self.get_cell_kwargs(datacn, key="checkbox")
@@ -1079,8 +1067,8 @@ class ColumnHeaders(tk.Canvas):
1079
1067
  h = space_bot
1080
1068
  if h < self.MT.min_header_height:
1081
1069
  h = int(self.MT.min_header_height)
1082
- elif h > self.MT.max_header_height:
1083
- h = int(self.MT.max_header_height)
1070
+ elif h > self.PAR.ops.max_header_height:
1071
+ h = int(self.PAR.ops.max_header_height)
1084
1072
  if not only_if_too_small or (only_if_too_small and h > self.current_height):
1085
1073
  self.set_height(h, set_TL=True)
1086
1074
  self.MT.main_table_redraw_grid_and_text(redraw_header=True, redraw_row_index=True)
@@ -1093,7 +1081,7 @@ class ColumnHeaders(tk.Canvas):
1093
1081
  only_if_too_small: bool = False,
1094
1082
  ) -> int:
1095
1083
  self.fix_header()
1096
- w = self.MT.min_column_width
1084
+ w = self.PAR.ops.min_column_width
1097
1085
  datacn = col if self.MT.all_columns_displayed else self.MT.displayed_columns[col]
1098
1086
  # header
1099
1087
  hw, hh_ = self.get_cell_dimensions(datacn)
@@ -1130,10 +1118,10 @@ class ColumnHeaders(tk.Canvas):
1130
1118
  w = hw
1131
1119
  if only_if_too_small and w < self.MT.col_positions[col + 1] - self.MT.col_positions[col]:
1132
1120
  w = self.MT.col_positions[col + 1] - self.MT.col_positions[col]
1133
- if w <= self.MT.min_column_width:
1134
- w = int(self.MT.min_column_width)
1135
- elif w > self.MT.max_column_width:
1136
- w = int(self.MT.max_column_width)
1121
+ if w <= self.PAR.ops.min_column_width:
1122
+ w = self.PAR.ops.min_column_width
1123
+ elif w > self.PAR.ops.max_column_width:
1124
+ w = int(self.PAR.ops.max_column_width)
1137
1125
  return w
1138
1126
 
1139
1127
  def set_col_width(
@@ -1146,10 +1134,10 @@ class ColumnHeaders(tk.Canvas):
1146
1134
  ) -> int:
1147
1135
  if width is None:
1148
1136
  width = self.get_col_text_width(col=col, visible_only=visible_only)
1149
- if width <= self.MT.min_column_width:
1150
- width = int(self.MT.min_column_width)
1151
- elif width > self.MT.max_column_width:
1152
- width = int(self.MT.max_column_width)
1137
+ if width <= self.PAR.ops.min_column_width:
1138
+ width = self.PAR.ops.min_column_width
1139
+ elif width > self.PAR.ops.max_column_width:
1140
+ width = int(self.PAR.ops.max_column_width)
1153
1141
  if only_if_too_small and width <= self.MT.col_positions[col + 1] - self.MT.col_positions[col]:
1154
1142
  return self.MT.col_positions[col + 1] - self.MT.col_positions[col]
1155
1143
  new_col_pos = self.MT.col_positions[col] + width
@@ -1772,7 +1760,6 @@ class ColumnHeaders(tk.Canvas):
1772
1760
  h = self.current_height + 1
1773
1761
  if text is None:
1774
1762
  text = self.get_cell_data(self.MT.datacn(c), none_to_empty_str=True, redirect_int=True)
1775
- bg, fg = self.PAR.ops.header_bg, self.PAR.ops.header_fg
1776
1763
  kwargs = {
1777
1764
  "menu_kwargs": DotDict(
1778
1765
  {
@@ -1790,8 +1777,10 @@ class ColumnHeaders(tk.Canvas):
1790
1777
  "width": w,
1791
1778
  "height": h,
1792
1779
  "show_border": True,
1793
- "bg": bg,
1794
- "fg": fg,
1780
+ "bg": self.PAR.ops.header_editor_bg,
1781
+ "fg": self.PAR.ops.header_editor_fg,
1782
+ "select_bg": self.PAR.ops.header_editor_select_bg,
1783
+ "select_fg": self.PAR.ops.header_editor_select_fg,
1795
1784
  "align": self.get_cell_align(c),
1796
1785
  "c": c,
1797
1786
  }
@@ -2017,19 +2006,13 @@ class ColumnHeaders(tk.Canvas):
2017
2006
  selected=self.MT.selected,
2018
2007
  )
2019
2008
  try_binding(self.dropdown.window.modified_function, event_data)
2020
- val = self.dropdown.window.search_and_see(event_data)
2021
2009
  # return to tk.Text action if control/command is held down
2022
2010
  # or keysym was not a character
2023
2011
  if (hasattr(event, "state") and event.state & (0x0004 | 0x00000010)) or (
2024
- hasattr(event, "keysym") and len(event.keysym) > 2
2012
+ hasattr(event, "keysym") and len(event.keysym) > 2 and event.keysym != "space"
2025
2013
  ):
2026
2014
  return
2027
- self.text_editor.tktext.unbind("<KeyRelease>")
2028
- self.text_editor.autocomplete(val)
2029
- self.text_editor.tktext.bind(
2030
- "<KeyRelease>",
2031
- self.dropdown_text_editor_modified,
2032
- )
2015
+ self.text_editor.autocomplete(self.dropdown.window.search_and_see(event_data))
2033
2016
  return "break"
2034
2017
 
2035
2018
  def open_dropdown_window(self, c: int, event: object = None) -> None:
@@ -2045,6 +2028,10 @@ class ColumnHeaders(tk.Canvas):
2045
2028
  reset_kwargs = {
2046
2029
  "r": 0,
2047
2030
  "c": c,
2031
+ "bg": self.PAR.ops.header_editor_bg,
2032
+ "fg": self.PAR.ops.header_editor_fg,
2033
+ "select_bg": self.PAR.ops.header_editor_select_bg,
2034
+ "select_fg": self.PAR.ops.header_editor_select_fg,
2048
2035
  "width": win_w,
2049
2036
  "height": win_h,
2050
2037
  "font": self.PAR.ops.header_font,
@@ -2074,12 +2061,12 @@ class ColumnHeaders(tk.Canvas):
2074
2061
  window=self.dropdown.window,
2075
2062
  anchor=anchor,
2076
2063
  )
2064
+ self.update_idletasks()
2077
2065
  if kwargs["state"] == "normal":
2078
2066
  self.text_editor.tktext.bind(
2079
2067
  "<KeyRelease>",
2080
2068
  self.dropdown_text_editor_modified,
2081
2069
  )
2082
- self.update_idletasks()
2083
2070
  try:
2084
2071
  self.after(1, lambda: self.text_editor.tktext.focus())
2085
2072
  self.after(2, self.text_editor.window.scroll_to_bottom())
@@ -2087,7 +2074,6 @@ class ColumnHeaders(tk.Canvas):
2087
2074
  return
2088
2075
  redraw = False
2089
2076
  else:
2090
- self.update_idletasks()
2091
2077
  self.dropdown.window.bind("<FocusOut>", lambda _x: self.close_dropdown_window(c))
2092
2078
  self.dropdown.window.bind("<Escape>", self.close_dropdown_window)
2093
2079
  self.dropdown.window.focus_set()
@@ -119,6 +119,12 @@ def dropdown_search_function(
119
119
  return None
120
120
 
121
121
 
122
+ def float_to_int(f: int | float) -> int | float:
123
+ if f == float("inf"):
124
+ return f
125
+ return int(f)
126
+
127
+
122
128
  def selection_box_tup_to_dict(box: tuple) -> dict:
123
129
  return {Box_nt(*box[:-1]): box[-1]}
124
130
 
@@ -1415,12 +1421,24 @@ def mod_span_widget(span: Span, widget: object) -> Span:
1415
1421
  def mod_event_val(
1416
1422
  event_data: EventDataDict,
1417
1423
  val: object,
1418
- loc: Loc | int,
1424
+ loc: Loc | None = None,
1425
+ row: int | None = None,
1426
+ column: int | None = None,
1419
1427
  ) -> EventDataDict:
1420
1428
  event_data.value = val
1421
- event_data.loc = Loc(*loc)
1422
- event_data.row = loc[0]
1423
- event_data.column = loc[1]
1429
+ if isinstance(loc, tuple):
1430
+ event_data.loc = Loc(*loc)
1431
+ event_data.row = loc[0]
1432
+ event_data.column = loc[1]
1433
+
1434
+ elif isinstance(row, int):
1435
+ event_data.loc = Loc(row=row)
1436
+ event_data.row = row
1437
+
1438
+ elif isinstance(column, int):
1439
+ event_data.loc = Loc(column=column)
1440
+ event_data.column = column
1441
+
1424
1442
  return event_data
1425
1443
 
1426
1444