Skip to content

ImagePlot.draw generates a fatal error when the window showing a plot was resized too small #528

@sallenEnth

Description

@sallenEnth

Problem Description
I have a plot shown in a window. There are a few tools added to the plot: a hovering tool, a selection tool, a zoom tool. When I resize the window so small that the plot does not show the application crashes. According to the traceback the error comes from Chaco.

Reproduction Steps:

I tried to reproduce with simple plots, but I cannot. My first thought is that the bug is related to the presence of the tools. I can share the traceback

Traceback (most recent call last):
  File "lib/python3.6/site-packages/enable/qt4/base_window.py", line 213, in paintEvent
    self.handler.paintEvent(event)
  File "lib/python3.6/site-packages/enable/qt4/base_window.py", line 65, in paintEvent
    self._enable_window._paint(event)
  File lib/python3.6/site-packages/enable/abstract_window.py", line 471, in _paint
    self.component.draw(gc, view_bounds=(0, 0, size[0], size[1]))
  File "lib/python3.6/site-packages/enable/component.py", line 427, in draw
    self._draw(gc, view_bounds, mode)
  File "lib/python3.6/site-packages/enable/component.py", line 779, in _draw
    self._dispatch_draw(layer, gc, view_bounds, mode)
  File "lib/python3.6/site-packages/enable/container.py", line 273, in _dispatch_draw
    component._dispatch_draw(layer, gc, new_bounds, mode)
  File "lib/python3.6/site-packages/enable/component.py", line 799, in _dispatch_draw
    handler(gc, view_bounds, mode)
  File "lib/python3.6/site-packages/chaco/base_2d_plot.py", line 204, in _draw_image
    self._render(gc)
  File "lib/python3.6/site-packages/chaco/image_plot.py", line 124, in _render
    self._compute_cached_image()
  File "lib/python3.6/site-packages/chaco/image_plot.py", line 255, in _compute_cached_image
    col_min, col_max, row_min, row_max = index_bounds
TypeError: 'NoneType' object is not iterable
Fatal Python error: Aborted

Expected behavior:

I would expect the plot to simply not show when the window is too small and that it would not crash my application. I would also expect that the tools won't be available.

OS, Python version: [Enter OS name and Python version]
The bug can be reproduced on Linux and MacOS, Python 3.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions