tksheet 7.2.23__tar.gz → 7.3.1__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 (24) hide show
  1. {tksheet-7.2.23/tksheet.egg-info → tksheet-7.3.1}/PKG-INFO +36 -12
  2. {tksheet-7.2.23 → tksheet-7.3.1}/README.md +34 -11
  3. {tksheet-7.2.23 → tksheet-7.3.1}/pyproject.toml +2 -1
  4. {tksheet-7.2.23 → tksheet-7.3.1}/tksheet/__init__.py +1 -1
  5. {tksheet-7.2.23 → tksheet-7.3.1}/tksheet/column_headers.py +53 -48
  6. {tksheet-7.2.23 → tksheet-7.3.1}/tksheet/functions.py +26 -9
  7. {tksheet-7.2.23 → tksheet-7.3.1}/tksheet/main_table.py +168 -88
  8. {tksheet-7.2.23 → tksheet-7.3.1}/tksheet/row_index.py +52 -48
  9. {tksheet-7.2.23 → tksheet-7.3.1}/tksheet/sheet.py +107 -79
  10. {tksheet-7.2.23 → tksheet-7.3.1}/tksheet/sheet_options.py +19 -0
  11. {tksheet-7.2.23 → tksheet-7.3.1}/tksheet/top_left_rectangle.py +14 -7
  12. {tksheet-7.2.23 → tksheet-7.3.1}/tksheet/types.py +8 -0
  13. {tksheet-7.2.23 → tksheet-7.3.1/tksheet.egg-info}/PKG-INFO +36 -12
  14. {tksheet-7.2.23 → tksheet-7.3.1}/LICENSE.txt +0 -0
  15. {tksheet-7.2.23 → tksheet-7.3.1}/setup.cfg +0 -0
  16. {tksheet-7.2.23 → tksheet-7.3.1}/tksheet/colors.py +0 -0
  17. {tksheet-7.2.23 → tksheet-7.3.1}/tksheet/formatters.py +0 -0
  18. {tksheet-7.2.23 → tksheet-7.3.1}/tksheet/other_classes.py +0 -0
  19. {tksheet-7.2.23 → tksheet-7.3.1}/tksheet/text_editor.py +0 -0
  20. {tksheet-7.2.23 → tksheet-7.3.1}/tksheet/themes.py +0 -0
  21. {tksheet-7.2.23 → tksheet-7.3.1}/tksheet/vars.py +0 -0
  22. {tksheet-7.2.23 → tksheet-7.3.1}/tksheet.egg-info/SOURCES.txt +0 -0
  23. {tksheet-7.2.23 → tksheet-7.3.1}/tksheet.egg-info/dependency_links.txt +0 -0
  24. {tksheet-7.2.23 → tksheet-7.3.1}/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.23
3
+ Version: 7.3.1
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.23"
9
+ version = "7.3.1"
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.23"
7
+ __version__ = "7.3.1"
8
8
 
9
9
  from .colors import (
10
10
  color_map,
@@ -28,10 +28,11 @@ from .functions import (
28
28
  consecutive_ranges,
29
29
  event_dict,
30
30
  get_n2a,
31
+ int_x_tuple,
31
32
  is_contiguous,
32
33
  new_tk_event,
33
- stored_event_dict,
34
34
  rounded_box_coords,
35
+ stored_event_dict,
35
36
  try_binding,
36
37
  )
37
38
  from .other_classes import (
@@ -43,6 +44,9 @@ from .other_classes import (
43
44
  from .text_editor import (
44
45
  TextEditor,
45
46
  )
47
+ from .types import (
48
+ AnyIter,
49
+ )
46
50
  from .vars import (
47
51
  USER_OS,
48
52
  rc_binding,
@@ -61,7 +65,7 @@ class ColumnHeaders(tk.Canvas):
61
65
  highlightthickness=0,
62
66
  )
63
67
  self.PAR = kwargs["parent"]
64
- self.current_height = None # is set from within MainTable() __init__ or from Sheet parameters
68
+ self.current_height = None
65
69
  self.MT = None # is set from within MainTable() __init__
66
70
  self.RI = None # is set from within MainTable() __init__
67
71
  self.TL = None # is set from within TopLeftRectangle() __init__
@@ -101,7 +105,6 @@ class ColumnHeaders(tk.Canvas):
101
105
  self.cell_options = {}
102
106
  self.rsz_w = None
103
107
  self.rsz_h = None
104
- self.new_col_height = 0
105
108
  self.lines_start_at = 0
106
109
  self.currently_resizing_width = False
107
110
  self.currently_resizing_height = False
@@ -191,14 +194,17 @@ class ColumnHeaders(tk.Canvas):
191
194
  self.lines_start_at -= 1
192
195
  self.MT.main_table_redraw_grid_and_text(redraw_header=True, redraw_row_index=False, redraw_table=False)
193
196
 
194
- def set_height(self, new_height: int, set_TL: bool = False) -> None:
195
- self.current_height = new_height
197
+ def set_height(self, new_height: int, set_TL: bool = False) -> bool:
196
198
  try:
197
199
  self.config(height=new_height)
198
200
  except Exception:
199
- return
201
+ return False
200
202
  if set_TL and self.TL is not None:
201
203
  self.TL.set_dimensions(new_h=new_height)
204
+ if expanded := isinstance(self.current_height, int) and new_height > self.current_height:
205
+ self.MT.recreate_all_selection_boxes()
206
+ self.current_height = new_height
207
+ return expanded
202
208
 
203
209
  def rc(self, event: object) -> None:
204
210
  self.mouseclick_outside_editor_or_dropdown_all_canvases(inside=True)
@@ -471,12 +477,7 @@ class ColumnHeaders(tk.Canvas):
471
477
  )
472
478
  self.MT.create_resize_line(line2x, y1, line2x, y2, width=1, fill=self.PAR.ops.resizing_line_fg, tag="rwl2")
473
479
  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
480
  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
481
  elif self.MT.identify_col(x=event.x, allow_end=False) is None:
481
482
  self.MT.deselect("all")
482
483
  elif self.col_selection_enabled and self.rsz_w is None and self.rsz_h is None:
@@ -504,7 +505,7 @@ class ColumnHeaders(tk.Canvas):
504
505
  if self.width_resizing_enabled and self.rsz_w is not None and self.currently_resizing_width:
505
506
  x = self.canvasx(event.x)
506
507
  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:
508
+ if size >= self.PAR.ops.min_column_width and size < self.PAR.ops.max_column_width:
508
509
  self.hide_resize_and_ctrl_lines(ctrl_lines=False)
509
510
  line2x = self.MT.col_positions[self.rsz_w - 1]
510
511
  self.create_resize_line(
@@ -539,17 +540,13 @@ class ColumnHeaders(tk.Canvas):
539
540
  elif self.height_resizing_enabled and self.rsz_h is not None and self.currently_resizing_height:
540
541
  evy = event.y
541
542
  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
543
+ if evy > self.PAR.ops.max_header_height:
544
+ evy = int(self.PAR.ops.max_header_height)
545
+ self.drag_height_resize(evy)
547
546
  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()
547
+ if evy < self.MT.min_header_height:
548
+ evy = int(self.MT.min_header_height)
549
+ self.drag_height_resize(evy)
553
550
  elif (
554
551
  self.drag_and_drop_enabled
555
552
  and self.col_selection_enabled
@@ -596,9 +593,9 @@ class ColumnHeaders(tk.Canvas):
596
593
  self.MT.main_table_redraw_grid_and_text(redraw_header=True, redraw_row_index=False)
597
594
  try_binding(self.extra_b1_motion_func, event)
598
595
 
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)
596
+ def drag_height_resize(self, height: int) -> None:
597
+ if self.set_height(height, set_TL=True):
598
+ self.MT.main_table_redraw_grid_and_text(redraw_header=True, redraw_row_index=False, redraw_table=False)
602
599
 
603
600
  def get_b1_motion_box(self, start_col: int, end_col: int) -> tuple[int, int, int, int, Literal["columns"]]:
604
601
  if end_col >= start_col:
@@ -781,10 +778,10 @@ class ColumnHeaders(tk.Canvas):
781
778
  new_col_pos = int(self.coords("rwl")[0])
782
779
  old_width = self.MT.col_positions[self.rsz_w] - self.MT.col_positions[self.rsz_w - 1]
783
780
  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)
781
+ if size < self.PAR.ops.min_column_width:
782
+ new_col_pos = ceil(self.MT.col_positions[self.rsz_w - 1] + self.PAR.ops.min_column_width)
783
+ elif size > self.PAR.ops.max_column_width:
784
+ new_col_pos = floor(self.MT.col_positions[self.rsz_w - 1] + self.PAR.ops.max_column_width)
788
785
  increment = new_col_pos - self.MT.col_positions[self.rsz_w]
789
786
  self.MT.col_positions[self.rsz_w + 1 :] = [
790
787
  e + increment for e in islice(self.MT.col_positions, self.rsz_w + 1, None)
@@ -820,9 +817,6 @@ class ColumnHeaders(tk.Canvas):
820
817
  self.drag_width_resize()
821
818
  self.currently_resizing_width = False
822
819
  self.hide_resize_and_ctrl_lines(ctrl_lines=False)
823
- elif self.height_resizing_enabled and self.rsz_h is not None and self.currently_resizing_height:
824
- self.currently_resizing_height = False
825
- self.drag_height_resize()
826
820
  elif (
827
821
  self.drag_and_drop_enabled
828
822
  and self.col_selection_enabled
@@ -938,20 +932,31 @@ class ColumnHeaders(tk.Canvas):
938
932
 
939
933
  def select_col(
940
934
  self,
941
- c: int,
935
+ c: int | AnyIter[int],
942
936
  redraw: bool = False,
943
937
  run_binding_func: bool = True,
944
938
  ext: bool = False,
945
- ) -> int:
939
+ ) -> int | list[int]:
946
940
  boxes_to_hide = tuple(self.MT.selection_boxes)
947
- fill_iid = self.MT.create_selection_box(0, c, len(self.MT.row_positions) - 1, c + 1, "columns", ext=ext)
941
+ fill_iids = [
942
+ self.MT.create_selection_box(
943
+ 0,
944
+ start,
945
+ len(self.MT.row_positions) - 1,
946
+ end,
947
+ "columns",
948
+ set_current=True,
949
+ ext=ext,
950
+ )
951
+ for start, end in consecutive_ranges(int_x_tuple(c))
952
+ ]
948
953
  for iid in boxes_to_hide:
949
954
  self.MT.hide_selection_box(iid)
950
955
  if redraw:
951
956
  self.MT.main_table_redraw_grid_and_text(redraw_header=True, redraw_row_index=True)
952
957
  if run_binding_func:
953
958
  self.MT.run_selection_binding("columns")
954
- return fill_iid
959
+ return fill_iids[0] if len(fill_iids) == 1 else fill_iids
955
960
 
956
961
  def add_selection(
957
962
  self,
@@ -1019,7 +1024,7 @@ class ColumnHeaders(tk.Canvas):
1019
1024
  w = b[2] - b[0] + 7
1020
1025
  h = b[3] - b[1] + 5
1021
1026
  else:
1022
- w = self.MT.min_column_width
1027
+ w = self.PAR.ops.min_column_width
1023
1028
  h = self.MT.min_header_height
1024
1029
  if datacn in self.cell_options and (
1025
1030
  self.get_cell_kwargs(datacn, key="dropdown") or self.get_cell_kwargs(datacn, key="checkbox")
@@ -1077,8 +1082,8 @@ class ColumnHeaders(tk.Canvas):
1077
1082
  h = space_bot
1078
1083
  if h < self.MT.min_header_height:
1079
1084
  h = int(self.MT.min_header_height)
1080
- elif h > self.MT.max_header_height:
1081
- h = int(self.MT.max_header_height)
1085
+ elif h > self.PAR.ops.max_header_height:
1086
+ h = int(self.PAR.ops.max_header_height)
1082
1087
  if not only_if_too_small or (only_if_too_small and h > self.current_height):
1083
1088
  self.set_height(h, set_TL=True)
1084
1089
  self.MT.main_table_redraw_grid_and_text(redraw_header=True, redraw_row_index=True)
@@ -1091,7 +1096,7 @@ class ColumnHeaders(tk.Canvas):
1091
1096
  only_if_too_small: bool = False,
1092
1097
  ) -> int:
1093
1098
  self.fix_header()
1094
- w = self.MT.min_column_width
1099
+ w = self.PAR.ops.min_column_width
1095
1100
  datacn = col if self.MT.all_columns_displayed else self.MT.displayed_columns[col]
1096
1101
  # header
1097
1102
  hw, hh_ = self.get_cell_dimensions(datacn)
@@ -1128,10 +1133,10 @@ class ColumnHeaders(tk.Canvas):
1128
1133
  w = hw
1129
1134
  if only_if_too_small and w < self.MT.col_positions[col + 1] - self.MT.col_positions[col]:
1130
1135
  w = self.MT.col_positions[col + 1] - self.MT.col_positions[col]
1131
- if w <= self.MT.min_column_width:
1132
- w = int(self.MT.min_column_width)
1133
- elif w > self.MT.max_column_width:
1134
- w = int(self.MT.max_column_width)
1136
+ if w <= self.PAR.ops.min_column_width:
1137
+ w = self.PAR.ops.min_column_width
1138
+ elif w > self.PAR.ops.max_column_width:
1139
+ w = int(self.PAR.ops.max_column_width)
1135
1140
  return w
1136
1141
 
1137
1142
  def set_col_width(
@@ -1144,10 +1149,10 @@ class ColumnHeaders(tk.Canvas):
1144
1149
  ) -> int:
1145
1150
  if width is None:
1146
1151
  width = self.get_col_text_width(col=col, visible_only=visible_only)
1147
- if width <= self.MT.min_column_width:
1148
- width = int(self.MT.min_column_width)
1149
- elif width > self.MT.max_column_width:
1150
- width = int(self.MT.max_column_width)
1152
+ if width <= self.PAR.ops.min_column_width:
1153
+ width = self.PAR.ops.min_column_width
1154
+ elif width > self.PAR.ops.max_column_width:
1155
+ width = int(self.PAR.ops.max_column_width)
1151
1156
  if only_if_too_small and width <= self.MT.col_positions[col + 1] - self.MT.col_positions[col]:
1152
1157
  return self.MT.col_positions[col + 1] - self.MT.col_positions[col]
1153
1158
  new_col_pos = self.MT.col_positions[col] + width
@@ -12,6 +12,8 @@ from collections import deque
12
12
  from collections.abc import (
13
13
  Callable,
14
14
  Generator,
15
+ Hashable,
16
+ Iterable,
15
17
  Iterator,
16
18
  Sequence,
17
19
  )
@@ -30,6 +32,9 @@ from .other_classes import (
30
32
  Loc,
31
33
  Span,
32
34
  )
35
+ from .types import (
36
+ AnyIter,
37
+ )
33
38
 
34
39
  unpickle_obj = pickle.loads
35
40
 
@@ -119,6 +124,12 @@ def dropdown_search_function(
119
124
  return None
120
125
 
121
126
 
127
+ def float_to_int(f: int | float) -> int | float:
128
+ if f == float("inf"):
129
+ return f
130
+ return int(f)
131
+
132
+
122
133
  def selection_box_tup_to_dict(box: tuple) -> dict:
123
134
  return {Box_nt(*box[:-1]): box[-1]}
124
135
 
@@ -289,13 +300,19 @@ def is_iterable(o: object) -> bool:
289
300
  return False
290
301
 
291
302
 
292
- def int_x_iter(i: Iterator[int] | int) -> Iterator[int]:
303
+ def int_x_iter(i: AnyIter[int] | int) -> AnyIter[int]:
293
304
  if isinstance(i, int):
294
305
  return (i,)
295
306
  return i
296
307
 
297
308
 
298
- def unpack(t: tuple[object] | tuple[Iterator[object]]) -> tuple[object]:
309
+ def int_x_tuple(i: AnyIter[int] | int) -> tuple[int]:
310
+ if isinstance(i, int):
311
+ return (i,)
312
+ return tuple(i)
313
+
314
+
315
+ def unpack(t: tuple[object] | tuple[AnyIter[object]]) -> tuple[object]:
299
316
  if not len(t):
300
317
  return t
301
318
  if is_iterable(t[0]) and len(t) == 1:
@@ -421,7 +438,7 @@ def consecutive_ranges(seq: Sequence[int]) -> Generator[tuple[int, int]]:
421
438
  yield seq[start], seq[-1] + 1
422
439
 
423
440
 
424
- def is_contiguous(iterable: Iterator[int]) -> bool:
441
+ def is_contiguous(iterable: Iterable[int]) -> bool:
425
442
  itr = iter(iterable)
426
443
  prev = next(itr)
427
444
  return all(i == (prev := prev + 1) for i in itr)
@@ -494,7 +511,7 @@ def cell_right_within_box(
494
511
 
495
512
 
496
513
  def get_last(
497
- it: Iterator,
514
+ it: AnyIter[object],
498
515
  ) -> object:
499
516
  if hasattr(it, "__reversed__"):
500
517
  try:
@@ -516,7 +533,7 @@ def index_exists(seq: Sequence[object], index: int) -> bool:
516
533
  return False
517
534
 
518
535
 
519
- def add_to_displayed(displayed: list[int], to_add: Iterator[int]) -> list[int]:
536
+ def add_to_displayed(displayed: list[int], to_add: Iterable[int]) -> list[int]:
520
537
  # assumes to_add is sorted in reverse
521
538
  for i in reversed(to_add):
522
539
  ins = bisect_left(displayed, i)
@@ -698,7 +715,7 @@ def diff_gen(seq: list[float]) -> Generator[int]:
698
715
  )
699
716
 
700
717
 
701
- def zip_fill_2nd_value(x: Iterator, o: object) -> Generator[object, object]:
718
+ def zip_fill_2nd_value(x: AnyIter[object], o: object) -> Generator[object, object]:
702
719
  return zip(x, repeat(o))
703
720
 
704
721
 
@@ -1227,13 +1244,13 @@ def span_froms(
1227
1244
  return from_r, from_c
1228
1245
 
1229
1246
 
1230
- def del_named_span_options(options: dict, itr: Iterator, type_: str) -> None:
1247
+ def del_named_span_options(options: dict, itr: AnyIter[Hashable], type_: str) -> None:
1231
1248
  for k in itr:
1232
1249
  if k in options and type_ in options[k]:
1233
1250
  del options[k][type_]
1234
1251
 
1235
1252
 
1236
- def del_named_span_options_nested(options: dict, itr1: Iterator, itr2: Iterator, type_: str) -> None:
1253
+ def del_named_span_options_nested(options: dict, itr1: AnyIter[Hashable], itr2: AnyIter[Hashable], type_: str) -> None:
1237
1254
  for k1 in itr1:
1238
1255
  for k2 in itr2:
1239
1256
  k = (k1, k2)
@@ -1314,7 +1331,7 @@ def set_align(
1314
1331
  def del_from_options(
1315
1332
  options: dict,
1316
1333
  key: str,
1317
- coords: int | Iterator | None = None,
1334
+ coords: int | AnyIter[int | tuple[int, int]] | None = None,
1318
1335
  ) -> dict:
1319
1336
  if isinstance(coords, int):
1320
1337
  if coords in options and key in options[coords]: