Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access table with cursor throw exception when "show_index=False" #5

Closed
zjl9959 opened this issue Jan 31, 2023 · 2 comments
Closed

Access table with cursor throw exception when "show_index=False" #5

zjl9959 opened this issue Jan 31, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@zjl9959
Copy link
Owner

zjl9959 commented Jan 31, 2023

Describe the bug:

  1. What's your test code?
import algviz
viz = algviz.Visualizer(1)
grid = viz.createTable(1, 1, [[1]], show_index=False)
r = viz.createCursor(0, 'r')
c = viz.createCursor(0, 'c')
grid[r][c]
viz.display()
  1. What's the exceptions?
  Table._add_cursor_(self, cursor, is_row)
  ...
  --> 413     self._svg.update_text_element(self._row_index2text[r], (pos_x, pos_y))
      414 for c in range(self._col):
      415     pos_x = (c + 0.5) * self._cell_width - self._label_font_size * len(str(c)) * 0.25 + self._cell_margin + self._row_cursor_mgr.get_cursors_occupy()

AttributeError: 'Table' object has no attribute '_row_index2text'
  1. [Optional] Add screenshots to help explain your problem.

Test enviroment:

  • OS: Windows
  • Algviz version: 0.2.2
  • Jupyter notebook version:

Additional context:
Add any other context about the problem here.

@zjl9959 zjl9959 added the bug Something isn't working label Jan 31, 2023
@zjl9959 zjl9959 self-assigned this Jan 31, 2023
@zjl9959
Copy link
Owner Author

zjl9959 commented Jan 31, 2023

import algviz
viz = algviz.Visualizer(1)
grid = viz.createTable(1, 1, [[1]], show_index=True)
r = viz.createCursor(0, 'r')
c = viz.createCursor(0, 'c')
grid[r][c]
viz.display()

This code can get the expect results.

@zjl9959
Copy link
Owner Author

zjl9959 commented May 24, 2023

Fixed in commit: 3b7b6f7

@zjl9959 zjl9959 closed this as completed May 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant