Skip to content

Commit c85d79f

Browse files
committed
fix #152
1 parent 0ba52c5 commit c85d79f

File tree

5 files changed

+21
-5
lines changed

5 files changed

+21
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
### Latest version in release notes is current version
22

3+
### Version 5.6.5
4+
Fixed:
5+
- [#152](https://github.com/ragardner/tksheet/issues/152)
6+
37
### Version 5.6.4
48
Fixed:
59
- `set_row_heights()`/`set_column_widths()` failing to set if iterable was empty

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
setup(
99
name = 'tksheet',
1010
packages = ['tksheet'],
11-
version = '5.6.4',
11+
version = '5.6.5',
1212
python_requires = '>=3.6',
1313
license = 'MIT',
1414
description = 'Tkinter table / sheet widget',
@@ -17,7 +17,7 @@
1717
author = 'ragardner',
1818
author_email = '[email protected]',
1919
url = 'https://github.com/ragardner/tksheet',
20-
download_url = 'https://github.com/ragardner/tksheet/archive/5.6.4.tar.gz',
20+
download_url = 'https://github.com/ragardner/tksheet/archive/5.6.5.tar.gz',
2121
keywords = ['tkinter', 'table', 'widget', 'sheet', 'grid', 'tk'],
2222
install_requires = [],
2323
classifiers = [

tksheet/_tksheet_column_headers.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1041,6 +1041,10 @@ def redraw_grid_and_text(self, last_col_line_pos, x1, x_stop, start_col, end_col
10411041
elif cell_alignment == "center":
10421042
x += ceil(box_w / 2) + 1
10431043
mw = mw - box_w - 1
1044+
try:
1045+
draw_check = self.MT._headers[dcol] if isinstance(self.MT._headers, (list, tuple)) else self.MT.data[self.MT._headers][dcol]
1046+
except:
1047+
draw_check = False
10441048
self.redraw_checkbox(dcol,
10451049
fc + 2,
10461050
0,
@@ -1049,7 +1053,7 @@ def redraw_grid_and_text(self, last_col_line_pos, x1, x_stop, start_col, end_col
10491053
fill = tf if self.cell_options[dcol]['checkbox']['state'] == "normal" else self.header_grid_fg,
10501054
outline = "",
10511055
tag = "cb",
1052-
draw_check = self.MT._headers[dcol] if isinstance(self.MT._headers, (list, tuple)) else self.MT.data[self.MT._headers][dcol])
1056+
draw_check = draw_check)
10531057

10541058
try:
10551059
if dcol in self.cell_options and 'checkbox' in self.cell_options[dcol]:

tksheet/_tksheet_main_table.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4217,14 +4217,18 @@ def main_table_redraw_grid_and_text(self, redraw_header = False, redraw_row_inde
42174217
elif cell_alignment == "center":
42184218
x = x + ceil(box_w / 2)
42194219
mw = mw - box_w - 1
4220+
try:
4221+
draw_check = self.data[r][dcol]
4222+
except:
4223+
draw_check = False
42204224
self.redraw_checkbox(r,
42214225
dcol,
42224226
fc + 2,
42234227
fr + 2,
42244228
fc + 2 + self.txt_h + 2,
42254229
fr + self.txt_h + 4,
42264230
fill = tf if self.cell_options[(r, dcol)]['checkbox']['state'] == "normal" else self.table_grid_fg,
4227-
outline = "", tag = "cb", draw_check = self.data[r][dcol])
4231+
outline = "", tag = "cb", draw_check = draw_check)
42284232

42294233
try:
42304234
if (r, dcol) in self.cell_options and 'checkbox' in self.cell_options[(r, dcol)]:

tksheet/_tksheet_row_index.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,10 @@ def redraw_grid_and_text(self, last_row_line_pos, y1, y_stop, start_row, end_row
10951095
elif cell_alignment == "center":
10961096
x += ceil(box_w / 2) + 1
10971097
mw = mw - box_w - 1
1098+
try:
1099+
draw_check = self.MT._row_index[r] if isinstance(self.MT._row_index, (list, tuple)) else self.MT.data[r][self.MT._row_index]
1100+
except:
1101+
draw_check = False
10981102
self.redraw_checkbox(r,
10991103
0,
11001104
fr + 2,
@@ -1103,7 +1107,7 @@ def redraw_grid_and_text(self, last_row_line_pos, y1, y_stop, start_row, end_row
11031107
fill = tf if self.cell_options[r]['checkbox']['state'] == "normal" else self.index_grid_fg,
11041108
outline = "",
11051109
tag = "cb",
1106-
draw_check = self.MT._row_index[r] if isinstance(self.MT._row_index, (list, tuple)) else self.MT.data[r][self.MT._row_index])
1110+
draw_check = draw_check)
11071111

11081112
try:
11091113
if r in self.cell_options and 'checkbox' in self.cell_options[r]:

0 commit comments

Comments
 (0)