Skip to content

Commit

Permalink
GUI: Fix toolbar error when changing reconciliation boolean options (#…
Browse files Browse the repository at this point in the history
…224)

Problem: the matplotlib toolbar could not be deleted properly, so it raises an exception. This is because when we update the toolbar for the "one per reconciliation windows," it creates a new toolbar using the code
```python
toolbar = NavigationToolbar2Tk(self.canvas, self.frame)
```
This toolbar variable disappears after the update function finishes. However, when we remove the toolbar, we call `self.toolbar.destroy()`.

Solution: tie the toolbar variable to self at creation
```python
self.toolbar = NavigationToolbar2Tk(self.canvas, self.frame)
```
Tested on macOS Catalina 10.15.5, can check/uncheck boolean options in #223 correctly.
  • Loading branch information
ssantichaivekin committed Aug 10, 2020
1 parent bd7823c commit 78ff0d7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions empress_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -962,8 +962,8 @@ def update_median_recons(self):
self.canvas.draw()
self.canvas.get_tk_widget().pack(side=tk.TOP, fill=tk.BOTH, expand=True)
# Recreate the toolbar
toolbar = NavigationToolbar2Tk(self.canvas, self.frame)
toolbar.update()
self.toolbar = NavigationToolbar2Tk(self.canvas, self.frame)
self.toolbar.update()

# p-value Histogram
class PValueHistogramWindow(tk.Frame):
Expand Down

0 comments on commit 78ff0d7

Please sign in to comment.