Trying to pop up a message box if no index is selected in a list box instead of performing the action in Python.
i=Studlistbox.curselection()
if i=='':
Mbox('Error', 'Nothing has been selected', 0)
else:
seltext=Studlistbox.get(i)
seltext=str(seltext)
seltext=seltext.replace(",",'').replace("(","").replace(")",'').replace("'",'')
for s in seltext.split(' '):
if is_number(s):
seltext=s
....
i get the following error if no item is selected:
File "C:\Python33\lib\tkinter__init__.py", line 2631, in get return self.tk.call(self._w, 'get', first) _tkinter.TclError: bad listbox index "": must be active, anchor, end, @x,y, or a number
Thanks for the help!
i
is but the error begs to differ. You need to inspecti
yourself and confirm it. - SpliFF