dmnfarrell / tkintertable

A pure Python library for adding tables to a Tkinter application

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Empty tables cause exceptions on mouse events

lanpirot opened this issue · comments

When I do stuff with my mouse over an empty table (with columns but without rows) I get all kinds of exceptions. Probably some values are only initialized, when there is at least one cell to show.

Mouseover, left mouse click, left mouse release, right mouse click and mouse drag throw uncaught exceptions. Nothing bad happens, but it seems to me it would be nicer without exceptions. This seems similar to some of the exceptions of #15.

Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1545, in __call__
    return self.func(*args)
  File "/home/lanpirot/.local/lib/python2.7/site-packages/tkintertable/Tables.py", line 2433, in handle_mouse_move
    if x > self.tablewidth+w:
AttributeError: ColumnHeader instance has no attribute 'tablewidth'
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1545, in __call__
    return self.func(*args)
  File "/home/lanpirot/.local/lib/python2.7/site-packages/tkintertable/Tables.py", line 2353, in handle_left_click
    if self.atdivider == 1:
AttributeError: ColumnHeader instance has no attribute 'atdivider'
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1545, in __call__
    return self.func(*args)
  File "/home/lanpirot/.local/lib/python2.7/site-packages/tkintertable/Tables.py", line 2370, in handle_left_release
    if self.atdivider == 1:
AttributeError: ColumnHeader instance has no attribute 'atdivider'
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1545, in __call__
    return self.func(*args)
  File "/home/lanpirot/.local/lib/python2.7/site-packages/tkintertable/Tables.py", line 2448, in handle_right_click
    self.handle_left_click(event)
  File "/home/lanpirot/.local/lib/python2.7/site-packages/tkintertable/Tables.py", line 2353, in handle_left_click
    if self.atdivider == 1:
AttributeError: ColumnHeader instance has no attribute 'atdivider'

Somewhat related, but this time in an non-empty table:

If I drag the columnheader right of the rightmost column:

Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1545, in __call__
    return self.func(*args)
  File "/home/lanpirot/.local/lib/python2.7/site-packages/tkintertable/Tables.py", line 990, in handle_mouse_drag
    self.multiplecollist=range(self.startcol, self.endcol+1)
TypeError: range() integer start argument expected, got NoneType.

And if I drag from the "empty space" right of the table:

Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1545, in __call__
    return self.func(*args)
  File "/home/lanpirot/.local/lib/python2.7/site-packages/tkintertable/Tables.py", line 2409, in handle_mouse_drag
    x1, y1, x2, y2 = self.coords('dragrect')
ValueError: need more than 0 values to unpack

i think this is fixed