Skip to content

Commit 6584883

Browse files
authored
Fix UnboundLocalError when clicking twice in tabs bar
Clicking twice in a blank space in tabs bar raises an exception trying to show the "Changing Tab label" dialog: ``` Exception in Tkinter callback Traceback (most recent call last): File "C:\runtimes\Anaconda3_64\Lib\tkinter\__init__.py", line 1705, in __call__ return self.func(*args) File "p:/repos/sqlitebro/sqlitebro.py", line 473, in btn_presstwice actions = [widget, index] UnboundLocalError: local variable 'index' referenced before assignment ``` Fixed as was only to be expected: with one tab :D
1 parent ba769fe commit 6584883

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

sqlite_bro/sqlite_bro.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -468,12 +468,12 @@ def btn_presstwice(self, event):
468468
if "label" in elem: # and widget.instate(['pressed']):
469469
index = widget.index("@%d,%d" % (x, y))
470470
titre = widget.tab(index, 'text')
471-
# determine selected table
472-
actions = [widget, index]
473-
title = 'Changing Tab label'
474-
fields = ['', ['current label', (titre), 'r', 30], '',
475-
['new label', titre, 'w', 30]]
476-
create_dialog(title, fields, ("Ok", self.btn_chg_tab_ok), actions)
471+
# determine selected table
472+
actions = [widget, index]
473+
title = 'Changing Tab label'
474+
fields = ['', ['current label', (titre), 'r', 30], '',
475+
['new label', titre, 'w', 30]]
476+
create_dialog(title, fields, ("Ok", self.btn_chg_tab_ok), actions)
477477

478478
def btn_press(self, event):
479479
"""button press over a widget with a 'close' element"""

0 commit comments

Comments
 (0)