Tk version changes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Robin Becker

    Tk version changes

    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::Priv and
    ::tk::TextClose stGap.

    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,ev ent):
    '''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','::t kPriv(selectMod e)','char')
    call('set','::t kPriv(mouseMove d)',0)
    call('set','::t kPriv(pressX)', x)
    call('set','::t kPriv(pressX)', x)
    w.mark_set('ins ert',call('tkTe xtClosestGap',s tr(w),x,y))
    w.mark_set('anc hor','insert')
    w.focus()
    w.tag_remove('s el','0.0','end' )
    return 'break'

    --
    Robin Becker
Working...