Hi,
I'm coding a GUI with Tkinter that works fine on Windows 8.1 (python 2.7.13, Tkinter 8.5) but not on Ubuntu Mate 17.04 (python 2.7.13, Tkinter 8.6).
Someone else succesfully tested it with python 3.4.2 and 3.5 (Tkinter 8.6) on :
-Ubuntu 16.06 RTS
- Ubuntu 12.04 (netbook)
- Debian 8
and with python 2.7.9 (Tkinter 8.6) on :
-Ubuntu 16.06 RTS
-Debian 8
I creat two listbox and bind them to execute two different functions :
On Windows and the other configuration listed before everything works as intended: only the correct binding instruction is executed.
Does it works with your configuration ? Have you any idea what could be the problem ?
I'm coding a GUI with Tkinter that works fine on Windows 8.1 (python 2.7.13, Tkinter 8.5) but not on Ubuntu Mate 17.04 (python 2.7.13, Tkinter 8.6).
Someone else succesfully tested it with python 3.4.2 and 3.5 (Tkinter 8.6) on :
-Ubuntu 16.06 RTS
- Ubuntu 12.04 (netbook)
- Debian 8
and with python 2.7.9 (Tkinter 8.6) on :
-Ubuntu 16.06 RTS
-Debian 8
I creat two listbox and bind them to execute two different functions :
from Tkinter import * class Interface(Frame): def __init__(self, window, **kwargs): Frame.__init__(self, window, **kwargs) self.grid() self.Test1 = Listbox(self,width=5, height=20) self.Test2 = Listbox(self,width=5, height=20) self.Test1.grid(row=0, column=0, columnspan=1, rowspan=15) self.Test2.grid(row=0, column=1, columnspan=1, rowspan=15) self.Test1.bind("<<ListboxSelect>>", self.print1) self.Test2.bind("<<ListboxSelect>>", self.print2) for i in range(10) : self.Test1.insert(i, i) for i in range(10, 20) : self.Test2.insert(i, i) def print1(self,event) : print self.Test1.get(self.Test1.curselection()) def print2(self,event) : print self.Test2.get(self.Test2.curselection()) if __name__ == '__main__': window= Tk() window.title('Test') window.resizable(width=True, height=True) interface = Interface(window) window.update_idletasks() screen_width = window.winfo_screenwidth() screen_height = window.winfo_screenheight() w = window.winfo_width() h = window.winfo_height() window.geometry("%dx%d+%d+%d"%(min(w,screen_width*2/3), min(h,screen_height*2/3), screen_width/2-w/2, screen_height/2-h/2)) window.mainloop()When clicking on "3" on the first list and then clicking on "16" on the second list I get :
3 16 Exception in Tkinter callback Traceback (most recent call last): File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1545, in __call__ return self.func(*args) File "test.py", line 27, in print1 print self.Test1.get(self.Test1.curselection()) File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 2632, in get return self.tk.call(self._w, 'get', first) TclError: bad listbox index "": must be active, anchor, end, @x,y, or a numberThe code seems to execute both binding instructions when the second click occurs.
On Windows and the other configuration listed before everything works as intended: only the correct binding instruction is executed.
Does it works with your configuration ? Have you any idea what could be the problem ?