R
Robin Becker
I have some tkinter code that used to work in 2.2, but is failing in
2.3. I guess it's because the Tcl version is different. Looking in the
text.tcl file I see that we now have ::tk:riv and
::tk::TextClosestGap.
I can get this to work reasonably in 2.3.2, but how should I make this
kind of code version independent? Should I rely on the python version or
attempt to check which variables are present in Tk? If the latter does
anyone know which version of Tk this changed?
def _textB1(self,event):
'''special binding for our disabled texts
Allows dragging to select and copy, but not editing
'''
w, x, y = event.widget, event.x, event.y
call = w.tk.call
call('set','::tkPriv(selectMode)','char')
call('set','::tkPriv(mouseMoved)',0)
call('set','::tkPriv(pressX)',x)
call('set','::tkPriv(pressX)',x)
w.mark_set('insert',call('tkTextClosestGap',str(w),x,y))
w.mark_set('anchor','insert')
w.focus()
w.tag_remove('sel','0.0','end')
return 'break'
2.3. I guess it's because the Tcl version is different. Looking in the
text.tcl file I see that we now have ::tk:riv and
::tk::TextClosestGap.
I can get this to work reasonably in 2.3.2, but how should I make this
kind of code version independent? Should I rely on the python version or
attempt to check which variables are present in Tk? If the latter does
anyone know which version of Tk this changed?
def _textB1(self,event):
'''special binding for our disabled texts
Allows dragging to select and copy, but not editing
'''
w, x, y = event.widget, event.x, event.y
call = w.tk.call
call('set','::tkPriv(selectMode)','char')
call('set','::tkPriv(mouseMoved)',0)
call('set','::tkPriv(pressX)',x)
call('set','::tkPriv(pressX)',x)
w.mark_set('insert',call('tkTextClosestGap',str(w),x,y))
w.mark_set('anchor','insert')
w.focus()
w.tag_remove('sel','0.0','end')
return 'break'