tksheet 6.1.7__tar.gz → 6.1.9__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.
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tksheet
3
- Version: 6.1.7
3
+ Version: 6.1.9
4
4
  Summary: Tkinter table / sheet widget
5
5
  Home-page: https://github.com/ragardner/tksheet
6
- Download-URL: https://github.com/ragardner/tksheet/archive/6.1.7.tar.gz
6
+ Download-URL: https://github.com/ragardner/tksheet/archive/6.1.9.tar.gz
7
7
  Author: ragardner
8
8
  Author-email: github@ragardner.simplelogin.com
9
9
  License: MIT
@@ -8,7 +8,7 @@ with open(path.join(this_directory, 'README.md'), encoding = 'utf-8') as f:
8
8
  setup(
9
9
  name = 'tksheet',
10
10
  packages = ['tksheet'],
11
- version = '6.1.7',
11
+ version = '6.1.9',
12
12
  python_requires = '>=3.6',
13
13
  license = 'MIT',
14
14
  description = 'Tkinter table / sheet widget',
@@ -17,7 +17,7 @@ setup(
17
17
  author = 'ragardner',
18
18
  author_email = 'github@ragardner.simplelogin.com',
19
19
  url = 'https://github.com/ragardner/tksheet',
20
- download_url = 'https://github.com/ragardner/tksheet/archive/6.1.7.tar.gz',
20
+ download_url = 'https://github.com/ragardner/tksheet/archive/6.1.9.tar.gz',
21
21
  keywords = ['tkinter', 'table', 'widget', 'sheet', 'grid', 'tk'],
22
22
  install_requires = [],
23
23
  classifiers = [
@@ -86,6 +86,8 @@ class Sheet(tk.Frame):
86
86
  after_redraw_time_ms: int = 20,
87
87
  row_index_width: int = None,
88
88
  auto_resize_default_row_index: bool = True,
89
+ auto_resize_columns: Union[int, None] = None,
90
+ auto_resize_rows: Union[int, None] = None,
89
91
  set_all_heights_and_widths: bool = False,
90
92
  row_height: str = "1", # str or int
91
93
  font: tuple = get_font(),
@@ -248,6 +250,8 @@ class Sheet(tk.Frame):
248
250
  headers=headers,
249
251
  header=header,
250
252
  data_reference=data if data_reference is None else data_reference,
253
+ auto_resize_columns=auto_resize_columns,
254
+ auto_resize_rows=auto_resize_rows,
251
255
  total_cols=total_columns,
252
256
  total_rows=total_rows,
253
257
  row_index=row_index,
@@ -2227,6 +2231,10 @@ class Sheet(tk.Frame):
2227
2231
  return self.MT.set_header_font(newfont)
2228
2232
 
2229
2233
  def set_options(self, redraw=True, **kwargs):
2234
+ if "auto_resize_columns" in kwargs:
2235
+ self.MT.auto_resize_columns = kwargs["auto_resize_columns"]
2236
+ if "auto_resize_rows" in kwargs:
2237
+ self.MT.auto_resize_rows = kwargs["auto_resize_rows"]
2230
2238
  if "to_clipboard_delimiter" in kwargs:
2231
2239
  self.MT.to_clipboard_delimiter = kwargs["to_clipboard_delimiter"]
2232
2240
  if "to_clipboard_quotechar" in kwargs:
@@ -428,6 +428,7 @@ class ColumnHeaders(tk.Canvas):
428
428
  col = self.rsz_w - 1
429
429
  old_width = self.MT.col_positions[self.rsz_w] - self.MT.col_positions[self.rsz_w - 1]
430
430
  new_width = self.set_col_width(col)
431
+ self.MT.allow_auto_resize_columns = False
431
432
  self.MT.main_table_redraw_grid_and_text(redraw_header=True, redraw_row_index=True)
432
433
  if self.column_width_resize_func is not None and old_width != new_width:
433
434
  self.column_width_resize_func(ResizeEvent("column_width_resize", col, old_width, new_width))
@@ -829,6 +830,7 @@ class ColumnHeaders(tk.Canvas):
829
830
  ]
830
831
  self.MT.col_positions[self.rsz_w] = new_col_pos
831
832
  new_width = self.MT.col_positions[self.rsz_w] - self.MT.col_positions[self.rsz_w - 1]
833
+ self.MT.allow_auto_resize_columns = False
832
834
  self.MT.recreate_all_selection_boxes()
833
835
  self.MT.main_table_redraw_grid_and_text(redraw_header=True, redraw_row_index=True)
834
836
  if self.column_width_resize_func is not None and old_width != new_width:
@@ -58,6 +58,8 @@ class MainTable(tk.Canvas):
58
58
  highlightthickness=0,
59
59
  )
60
60
  self.parentframe = kwargs["parentframe"]
61
+ self.parentframe_width = 0
62
+ self.parentframe_height = 0
61
63
  self.b1_pressed_loc = None
62
64
  self.existing_dropdown_canvas_id = None
63
65
  self.existing_dropdown_window = None
@@ -123,6 +125,10 @@ class MainTable(tk.Canvas):
123
125
  self.paste_insert_row_limit = kwargs["paste_insert_row_limit"]
124
126
  self.arrow_key_down_right_scroll_page = kwargs["arrow_key_down_right_scroll_page"]
125
127
  self.cell_auto_resize_enabled = kwargs["enable_edit_cell_auto_resize"]
128
+ self.auto_resize_columns = kwargs["auto_resize_columns"]
129
+ self.auto_resize_rows = kwargs["auto_resize_rows"]
130
+ self.allow_auto_resize_columns = True
131
+ self.allow_auto_resize_rows = True
126
132
  self.edit_cell_validation = kwargs["edit_cell_validation"]
127
133
  self.display_selected_fg_over_highlights = kwargs["display_selected_fg_over_highlights"]
128
134
  self.show_index = kwargs["show_index"]
@@ -330,12 +336,23 @@ class MainTable(tk.Canvas):
330
336
  self.basic_bindings()
331
337
  self.create_rc_menus()
332
338
 
333
- def refresh(self, event=None):
339
+ def refresh(self, event=None) -> None:
340
+ self.main_table_redraw_grid_and_text(True, True)
341
+
342
+ def window_configured(self, event) -> None:
343
+ w = self.parentframe.winfo_width()
344
+ if w != self.parentframe_width:
345
+ self.parentframe_width = w
346
+ self.allow_auto_resize_columns = True
347
+ h = self.parentframe.winfo_height()
348
+ if h != self.parentframe_height:
349
+ self.parentframe_height = h
350
+ self.allow_auto_resize_rows = True
334
351
  self.main_table_redraw_grid_and_text(True, True)
335
352
 
336
353
  def basic_bindings(self, enable=True):
337
354
  if enable:
338
- self.bind("<Configure>", self.refresh)
355
+ self.bind("<Configure>", self.window_configured)
339
356
  self.bind("<Motion>", self.mouse_motion)
340
357
  self.bind("<ButtonPress-1>", self.b1_press)
341
358
  self.bind("<B1-Motion>", self.b1_motion)
@@ -1797,7 +1814,7 @@ class MainTable(tk.Canvas):
1797
1814
  self.delete_current()
1798
1815
  deselected = ("deselect_all_cols", deleted_boxes)
1799
1816
  elif r is not None and c is None and cell is None:
1800
- current = self.find_withtag("currently")
1817
+ current = self.find_withtag("selected")
1801
1818
  current_tags = self.gettags(current[0]) if current else tuple()
1802
1819
  if current:
1803
1820
  curr_r1, curr_c1, curr_r2, curr_c2 = tuple(int(e) for e in current_tags[1].split("_") if e)
@@ -1819,7 +1836,7 @@ class MainTable(tk.Canvas):
1819
1836
  self.set_current_to_last()
1820
1837
  deselected = ("deselect_row", deleted_boxes)
1821
1838
  elif c is not None and r is None and cell is None:
1822
- current = self.find_withtag("currently")
1839
+ current = self.find_withtag("selected")
1823
1840
  current_tags = self.gettags(current[0]) if current else tuple()
1824
1841
  if current:
1825
1842
  curr_r1, curr_c1, curr_r2, curr_c2 = tuple(int(e) for e in current_tags[1].split("_") if e)
@@ -1848,7 +1865,7 @@ class MainTable(tk.Canvas):
1848
1865
  self.find_withtag("cells"),
1849
1866
  self.find_withtag("rows"),
1850
1867
  self.find_withtag("columns"),
1851
- self.find_withtag("currently"),
1868
+ self.find_withtag("selected"),
1852
1869
  ):
1853
1870
  alltags = self.gettags(item)
1854
1871
  if alltags:
@@ -3037,7 +3054,7 @@ class MainTable(tk.Canvas):
3037
3054
  else:
3038
3055
  self.select_cell(rowsel, colsel, redraw=False)
3039
3056
  last_selected = tuple(
3040
- int(e) for e in self.gettags(self.find_withtag("currently"))[1].split("_") if e
3057
+ int(e) for e in self.gettags(self.find_withtag("selected"))[1].split("_") if e
3041
3058
  )
3042
3059
  self.main_table_redraw_grid_and_text(redraw_header=True, redraw_row_index=True, redraw_table=True)
3043
3060
  if self.shift_selection_binding_func is not None:
@@ -3611,6 +3628,8 @@ class MainTable(tk.Canvas):
3611
3628
  self.RI.row_height_resize_func(ResizeEvent("row_height_resize", r, old_height, new_height))
3612
3629
  if cell_needs_resize_w or cell_needs_resize_h:
3613
3630
  self.recreate_all_selection_boxes()
3631
+ self.allow_auto_resize_columns = not cell_needs_resize_w
3632
+ self.allow_auto_resize_rows = not cell_needs_resize_h
3614
3633
  if redraw:
3615
3634
  self.refresh()
3616
3635
  return True
@@ -4768,22 +4787,62 @@ class MainTable(tk.Canvas):
4768
4787
  t = self.create_polygon(points, fill=fill, outline=outline, tag=tag, smooth=True)
4769
4788
  self.disp_checkbox[t] = True
4770
4789
 
4771
- def main_table_redraw_grid_and_text(self, redraw_header=False, redraw_row_index=False, redraw_table=True):
4772
- last_col_line_pos = self.col_positions[-1] + 1
4773
- last_row_line_pos = self.row_positions[-1] + 1
4790
+ def main_table_redraw_grid_and_text(self, redraw_header=False, redraw_row_index=False, redraw_table=True,):
4774
4791
  try:
4775
4792
  can_width = self.winfo_width()
4776
4793
  can_height = self.winfo_height()
4777
- self.configure(
4778
- scrollregion=(
4779
- 0,
4780
- 0,
4781
- last_col_line_pos + self.empty_horizontal,
4782
- last_row_line_pos + self.empty_vertical,
4783
- )
4784
- )
4785
4794
  except Exception:
4786
- return
4795
+ return False
4796
+ row_pos_exists = self.row_positions != [0] and self.row_positions
4797
+ col_pos_exists = self.col_positions != [0] and self.col_positions
4798
+ resized_cols = False
4799
+ resized_rows = False
4800
+ if self.auto_resize_columns and self.allow_auto_resize_columns and col_pos_exists:
4801
+ max_w = int(can_width)
4802
+ max_w -= self.empty_horizontal
4803
+ if (len(self.col_positions) - 1) * self.auto_resize_columns < max_w:
4804
+ resized_cols = True
4805
+ change = int((max_w - self.col_positions[-1]) / (len(self.col_positions) - 1))
4806
+ widths = [
4807
+ int(b - a) + change - 1
4808
+ for a, b in zip(self.col_positions, islice(self.col_positions, 1, len(self.col_positions)))
4809
+ ]
4810
+ diffs = {}
4811
+ for i, w in enumerate(widths):
4812
+ if w < self.auto_resize_columns:
4813
+ diffs[i] = self.auto_resize_columns - w
4814
+ widths[i] = self.auto_resize_columns
4815
+ if diffs and len(diffs) < len(widths):
4816
+ change = sum(diffs.values()) / (len(widths) - len(diffs))
4817
+ for i, w in enumerate(widths):
4818
+ if i not in diffs:
4819
+ widths[i] -= change
4820
+ self.col_positions = list(accumulate(chain([0], widths)))
4821
+ if self.auto_resize_rows and self.allow_auto_resize_rows and row_pos_exists:
4822
+ max_h = int(can_height)
4823
+ max_h -= self.empty_vertical
4824
+ if (len(self.row_positions) - 1) * self.auto_resize_rows < max_h:
4825
+ resized_rows = True
4826
+ change = int((max_h - self.row_positions[-1]) / (len(self.row_positions) - 1))
4827
+ heights = [
4828
+ int(b - a) + change - 1
4829
+ for a, b in zip(self.row_positions, islice(self.row_positions, 1, len(self.row_positions)))
4830
+ ]
4831
+ diffs = {}
4832
+ for i, h in enumerate(heights):
4833
+ if h < self.auto_resize_rows:
4834
+ diffs[i] = self.auto_resize_rows - h
4835
+ heights[i] = self.auto_resize_rows
4836
+ if diffs and len(diffs) < len(heights):
4837
+ change = sum(diffs.values()) / (len(heights) - len(diffs))
4838
+ for i, h in enumerate(heights):
4839
+ if i not in diffs:
4840
+ heights[i] -= change
4841
+ self.row_positions = list(accumulate(chain([0], heights)))
4842
+ if resized_cols or resized_rows:
4843
+ self.recreate_all_selection_boxes()
4844
+ last_col_line_pos = self.col_positions[-1] + 1
4845
+ last_row_line_pos = self.row_positions[-1] + 1
4787
4846
  if can_width >= last_col_line_pos + self.empty_horizontal and self.parentframe.xscroll_showing:
4788
4847
  self.parentframe.xscroll.grid_forget()
4789
4848
  self.parentframe.xscroll_showing = False
@@ -4791,7 +4850,7 @@ class MainTable(tk.Canvas):
4791
4850
  can_width < last_col_line_pos + self.empty_horizontal
4792
4851
  and not self.parentframe.xscroll_showing
4793
4852
  and not self.parentframe.xscroll_disabled
4794
- and can_height > 45
4853
+ and can_height > 40
4795
4854
  ):
4796
4855
  self.parentframe.xscroll.grid(row=2, column=0, columnspan=2, sticky="nswe")
4797
4856
  self.parentframe.xscroll_showing = True
@@ -4802,20 +4861,31 @@ class MainTable(tk.Canvas):
4802
4861
  can_height < last_row_line_pos + self.empty_vertical
4803
4862
  and not self.parentframe.yscroll_showing
4804
4863
  and not self.parentframe.yscroll_disabled
4805
- and can_width > 45
4864
+ and can_width > 40
4806
4865
  ):
4807
4866
  self.parentframe.yscroll.grid(row=0, column=2, rowspan=3, sticky="nswe")
4808
4867
  self.parentframe.yscroll_showing = True
4868
+ self.configure(
4869
+ scrollregion=(
4870
+ 0,
4871
+ 0,
4872
+ last_col_line_pos + self.empty_horizontal + 2,
4873
+ last_row_line_pos + self.empty_vertical + 2,
4874
+ )
4875
+ )
4809
4876
  scrollpos_bot = self.canvasy(can_height)
4810
4877
  end_row = bisect.bisect_right(self.row_positions, scrollpos_bot)
4811
4878
  if not scrollpos_bot >= self.row_positions[-1]:
4812
4879
  end_row += 1
4813
4880
  if redraw_row_index and self.show_index:
4814
4881
  self.RI.auto_set_index_width(end_row - 1)
4882
+ # return
4815
4883
  scrollpos_left = self.canvasx(0)
4816
4884
  scrollpos_top = self.canvasy(0)
4817
4885
  scrollpos_right = self.canvasx(can_width)
4818
4886
  start_row = bisect.bisect_left(self.row_positions, scrollpos_top)
4887
+ start_col = bisect.bisect_left(self.col_positions, scrollpos_left)
4888
+ end_col = bisect.bisect_right(self.col_positions, scrollpos_right)
4819
4889
  self.row_width_resize_bbox = (
4820
4890
  scrollpos_left,
4821
4891
  scrollpos_top,
@@ -4846,8 +4916,7 @@ class MainTable(tk.Canvas):
4846
4916
  self.disp_dropdown = {}
4847
4917
  self.hidd_checkbox.update(self.disp_checkbox)
4848
4918
  self.disp_checkbox = {}
4849
- start_col = bisect.bisect_left(self.col_positions, scrollpos_left)
4850
- end_col = bisect.bisect_right(self.col_positions, scrollpos_right)
4919
+
4851
4920
  if not scrollpos_right >= self.col_positions[-1]:
4852
4921
  end_col += 1
4853
4922
  if last_col_line_pos > scrollpos_right:
@@ -4858,8 +4927,6 @@ class MainTable(tk.Canvas):
4858
4927
  y_stop = scrollpos_bot
4859
4928
  else:
4860
4929
  y_stop = last_row_line_pos
4861
- row_pos_exists = self.row_positions != [0] and self.row_positions
4862
- col_pos_exists = self.col_positions != [0] and self.col_positions
4863
4930
  if self.show_horizontal_grid and row_pos_exists:
4864
4931
  self.grid_cyc = cycle(self.grid_cyctup)
4865
4932
  points = []
@@ -5281,7 +5348,7 @@ class MainTable(tk.Canvas):
5281
5348
  self.hidd_checkbox[t] = False
5282
5349
  if self.show_selected_cells_border:
5283
5350
  self.tag_raise("cellsbd")
5284
- self.tag_raise("currently")
5351
+ self.tag_raise("selected")
5285
5352
  self.tag_raise("rowsbd")
5286
5353
  self.tag_raise("columnsbd")
5287
5354
  if redraw_header and self.show_header:
@@ -5312,7 +5379,7 @@ class MainTable(tk.Canvas):
5312
5379
  self.find_withtag("cells")
5313
5380
  + self.find_withtag("rows")
5314
5381
  + self.find_withtag("columns")
5315
- + self.find_withtag("currently")
5382
+ + self.find_withtag("selected")
5316
5383
  )
5317
5384
 
5318
5385
  def get_boxes(self, include_current=True):
@@ -5325,7 +5392,7 @@ class MainTable(tk.Canvas):
5325
5392
  boxes[tuple(int(e) for e in alltags[1].split("_") if e)] = "rows"
5326
5393
  elif alltags[0] == "columns":
5327
5394
  boxes[tuple(int(e) for e in alltags[1].split("_") if e)] = "columns"
5328
- elif include_current and alltags[0] == "currently":
5395
+ elif include_current and alltags[0] == "selected":
5329
5396
  boxes[tuple(int(e) for e in alltags[1].split("_") if e)] = f"{alltags[2]}"
5330
5397
  return boxes
5331
5398
 
@@ -5402,13 +5469,13 @@ class MainTable(tk.Canvas):
5402
5469
  self.RI.delete("columns", "columnsbd")
5403
5470
  self.CH.delete("columns", "columnsbd")
5404
5471
  if delete_current:
5405
- self.delete("currently")
5406
- self.RI.delete("currently")
5407
- self.CH.delete("currently")
5472
+ self.delete("selected")
5473
+ self.RI.delete("selected")
5474
+ self.CH.delete("selected")
5408
5475
  return deleted_boxes
5409
5476
 
5410
5477
  def currently_selected(self):
5411
- items = self.find_withtag("currently")
5478
+ items = self.find_withtag("selected")
5412
5479
  if not items:
5413
5480
  return tuple()
5414
5481
  alltags = self.gettags(items[0])
@@ -5416,7 +5483,7 @@ class MainTable(tk.Canvas):
5416
5483
  return CurrentlySelectedClass(box[0], box[1], alltags[2])
5417
5484
 
5418
5485
  def get_tags_of_current(self):
5419
- items = self.find_withtag("currently")
5486
+ items = self.find_withtag("selected")
5420
5487
  if items:
5421
5488
  return self.gettags(items[0])
5422
5489
  else:
@@ -5424,17 +5491,17 @@ class MainTable(tk.Canvas):
5424
5491
 
5425
5492
  def set_currently_selected(self, r, c, type_="cell"): # cell, column or row
5426
5493
  r1, c1, r2, c2 = r, c, r + 1, c + 1
5427
- self.delete("currently")
5428
- self.RI.delete("currently")
5429
- self.CH.delete("currently")
5494
+ self.delete("selected")
5495
+ self.RI.delete("selected")
5496
+ self.CH.delete("selected")
5430
5497
  if self.col_positions == [0]:
5431
5498
  c1 = 0
5432
5499
  c2 = 0
5433
5500
  if self.row_positions == [0]:
5434
5501
  r1 = 0
5435
5502
  r2 = 0
5436
- tagr = ("currently", f"{r1}_{c1}_{r2}_{c2}", type_)
5437
- tag_index_header = ("cells", f"{r1}_{c1}_{r2}_{c2}")
5503
+ tagr = ("selected", f"{r1}_{c1}_{r2}_{c2}", type_)
5504
+ tag_index_header = ("cells", f"{r1}_{c1}_{r2}_{c2}", "selected")
5438
5505
  if type_ == "cell":
5439
5506
  outline = self.table_selected_cells_border_fg
5440
5507
  elif type_ == "row":
@@ -5501,9 +5568,9 @@ class MainTable(tk.Canvas):
5501
5568
  return tuple()
5502
5569
 
5503
5570
  def delete_current(self):
5504
- self.delete("currently")
5505
- self.RI.delete("currently")
5506
- self.CH.delete("currently")
5571
+ self.delete("selected")
5572
+ self.RI.delete("selected")
5573
+ self.CH.delete("selected")
5507
5574
 
5508
5575
  def create_selected(
5509
5576
  self,
@@ -5516,21 +5583,22 @@ class MainTable(tk.Canvas):
5516
5583
  state="normal",
5517
5584
  ):
5518
5585
  self.itemconfig("cells", state="normal")
5586
+ coords = f"{r1}_{c1}_{r2}_{c2}"
5519
5587
  if type_ == "cells":
5520
- tagr = ("cells", f"{r1}_{c1}_{r2}_{c2}")
5521
- tagb = ("cellsbd", f"{r1}_{c1}_{r2}_{c2}")
5588
+ tagr = ("cells", coords)
5589
+ tagb = ("cellsbd", coords)
5522
5590
  mt_bg = self.table_selected_cells_bg
5523
5591
  mt_border_col = self.table_selected_cells_border_fg
5524
5592
  elif type_ == "rows":
5525
- tagr = ("rows", f"{r1}_{c1}_{r2}_{c2}")
5526
- tagb = ("rowsbd", f"{r1}_{c1}_{r2}_{c2}")
5527
- tag_index_header = ("cells", f"{r1}_{c1}_{r2}_{c2}")
5593
+ tagr = ("rows", coords)
5594
+ tagb = ("rowsbd", coords)
5595
+ tag_index_header = ("cells", coords)
5528
5596
  mt_bg = self.table_selected_rows_bg
5529
5597
  mt_border_col = self.table_selected_rows_border_fg
5530
5598
  elif type_ == "columns":
5531
- tagr = ("columns", f"{r1}_{c1}_{r2}_{c2}")
5532
- tagb = ("columnsbd", f"{r1}_{c1}_{r2}_{c2}")
5533
- tag_index_header = ("cells", f"{r1}_{c1}_{r2}_{c2}")
5599
+ tagr = ("columns", coords)
5600
+ tagb = ("columnsbd", coords)
5601
+ tag_index_header = ("cells", coords)
5534
5602
  mt_bg = self.table_selected_columns_bg
5535
5603
  mt_border_col = self.table_selected_columns_border_fg
5536
5604
  self.last_selected = (r1, c1, r2, c2, type_)
@@ -5590,15 +5658,16 @@ class MainTable(tk.Canvas):
5590
5658
  return r, b
5591
5659
 
5592
5660
  def recreate_all_selection_boxes(self):
5661
+ curr = self.currently_selected()
5593
5662
  for item in chain(
5594
5663
  self.find_withtag("cells"),
5595
5664
  self.find_withtag("rows"),
5596
5665
  self.find_withtag("columns"),
5597
- self.find_withtag("currently"),
5598
5666
  ):
5599
5667
  tags = self.gettags(item)
5600
5668
  if tags:
5601
5669
  r1, c1, r2, c2 = tuple(int(e) for e in tags[1].split("_") if e)
5670
+ state = self.itemcget(item, "state")
5602
5671
  self.delete(f"{r1}_{c1}_{r2}_{c2}")
5603
5672
  self.RI.delete(f"{r1}_{c1}_{r2}_{c2}")
5604
5673
  self.CH.delete(f"{r1}_{c1}_{r2}_{c2}")
@@ -5608,10 +5677,9 @@ class MainTable(tk.Canvas):
5608
5677
  r2 = len(self.row_positions) - 1
5609
5678
  if c2 > len(self.col_positions) - 1:
5610
5679
  c2 = len(self.col_positions) - 1
5611
- if tags[0] == "currently":
5612
- self.set_currently_selected(r1, c1, tags[2])
5613
- else:
5614
- self.create_selected(r1, c1, r2, c2, tags[0])
5680
+ self.create_selected(r1, c1, r2, c2, tags[0], state=state)
5681
+ if curr:
5682
+ self.set_currently_selected(curr.row, curr.column, curr.type_)
5615
5683
  self.tag_lower("rows")
5616
5684
  self.RI.tag_lower("rows")
5617
5685
  self.tag_lower("columns")
@@ -5620,7 +5688,7 @@ class MainTable(tk.Canvas):
5620
5688
  self.RI.tag_lower("cells")
5621
5689
  self.CH.tag_lower("cells")
5622
5690
  if not self.show_selected_cells_border:
5623
- self.tag_lower("currently")
5691
+ self.tag_lower("selected")
5624
5692
 
5625
5693
  def get_redraw_selections(self, startr, endr, startc, endc):
5626
5694
  d = defaultdict(list)
@@ -5655,7 +5723,7 @@ class MainTable(tk.Canvas):
5655
5723
  self.find_withtag("cells"),
5656
5724
  self.find_withtag("rows"),
5657
5725
  self.find_withtag("columns"),
5658
- self.find_withtag("currently"),
5726
+ self.find_withtag("selected"),
5659
5727
  ):
5660
5728
  r1, c1, r2, c2 = tuple(int(e) for e in self.gettags(item)[1].split("_") if e)
5661
5729
  if r1 < min_y:
@@ -5898,7 +5966,7 @@ class MainTable(tk.Canvas):
5898
5966
  return True
5899
5967
  return False
5900
5968
 
5901
- # don't have to use "currently" because you can't have a current without a selection box
5969
+ # don't have to use "selected" because you can't have a current without a selection box
5902
5970
  def cell_selected(self, r, c, inc_cols=False, inc_rows=False):
5903
5971
  if not isinstance(r, int) or not isinstance(c, int):
5904
5972
  return False
@@ -5959,11 +6027,11 @@ class MainTable(tk.Canvas):
5959
6027
  return tuple()
5960
6028
 
5961
6029
  def hide_current(self):
5962
- for item in self.find_withtag("currently"):
6030
+ for item in self.find_withtag("selected"):
5963
6031
  self.itemconfig(item, state="hidden")
5964
6032
 
5965
6033
  def show_current(self):
5966
- for item in self.find_withtag("currently"):
6034
+ for item in self.find_withtag("selected"):
5967
6035
  self.itemconfig(item, state="normal")
5968
6036
 
5969
6037
  def open_cell(self, event=None, ignore_existing_editor=False):
@@ -374,6 +374,7 @@ class RowIndex(tk.Canvas):
374
374
  row = self.rsz_h - 1
375
375
  old_height = self.MT.row_positions[self.rsz_h] - self.MT.row_positions[self.rsz_h - 1]
376
376
  new_height = self.set_row_height(row)
377
+ self.MT.allow_auto_resize_rows = False
377
378
  self.MT.main_table_redraw_grid_and_text(redraw_header=True, redraw_row_index=True)
378
379
  if self.row_height_resize_func is not None and old_height != new_height:
379
380
  self.row_height_resize_func(ResizeEvent("row_height_resize", row, old_height, new_height))
@@ -783,6 +784,7 @@ class RowIndex(tk.Canvas):
783
784
  e + increment for e in islice(self.MT.row_positions, self.rsz_h + 1, len(self.MT.row_positions))
784
785
  ]
785
786
  self.MT.row_positions[self.rsz_h] = new_row_pos
787
+ self.MT.allow_auto_resize_rows = False
786
788
  new_height = self.MT.row_positions[self.rsz_h] - self.MT.row_positions[self.rsz_h - 1]
787
789
  self.MT.recreate_all_selection_boxes()
788
790
  self.MT.main_table_redraw_grid_and_text(redraw_header=True, redraw_row_index=True)
@@ -1,9 +1,9 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tksheet
3
- Version: 6.1.7
3
+ Version: 6.1.9
4
4
  Summary: Tkinter table / sheet widget
5
5
  Home-page: https://github.com/ragardner/tksheet
6
- Download-URL: https://github.com/ragardner/tksheet/archive/6.1.7.tar.gz
6
+ Download-URL: https://github.com/ragardner/tksheet/archive/6.1.9.tar.gz
7
7
  Author: ragardner
8
8
  Author-email: github@ragardner.simplelogin.com
9
9
  License: MIT
File without changes
File without changes
File without changes
File without changes