IDLE dedent/unindent key bindings for non-us keybord?

Discussion in 'Python' started by gjohannes@gmail.com, Oct 2, 2005.

  1. Guest

    Hi.

    I use Idle 1.1.1 on Python 2.4.1.

    The "Ctrl-[" and "Ctrl-]" key bindings for indenting do not work on
    non-us keyboards where brackets are accessed by the "Alt Gr" key.

    The Tab key seem to work for indenting a selected textblock on my
    swedish keyboard, but Shift-tab does not dedent as you would have
    expected.

    If I try to redefine key bindings in "options->Configure IDLE->Keys" so
    that Shift-Tab is bound to dedent, things seem to get really weird.

    After creating a "Custom key set"
    - the "Ok"-button does not close the options window, I have to use
    "Cancel" to get out.

    - Tab does not longer indent selected text, but replaces it with a tab
    character instead.

    - Shift->Tab does nothing.

    - F5 for Run module does nothing

    and so on.


    What could be wrong here, and do you have any other suggestions for a
    "dedent" key binding that may work on a non-us/swedish keyboard (or
    maybe an alternative editor for python code).

    Thanks.
    , Oct 2, 2005
    #1
    1. Advertising

  2. On 2 Oct 2005 08:52:53 -0700, wrote:

    >Hi.
    >
    >I use Idle 1.1.1 on Python 2.4.1.
    >
    >The "Ctrl-[" and "Ctrl-]" key bindings for indenting do not work on
    >non-us keyboards where brackets are accessed by the "Alt Gr" key.
    >
    >The Tab key seem to work for indenting a selected textblock on my
    >swedish keyboard, but Shift-tab does not dedent as you would have
    >expected.
    >
    >If I try to redefine key bindings in "options->Configure IDLE->Keys" so
    >that Shift-Tab is bound to dedent, things seem to get really weird.
    >
    >After creating a "Custom key set"
    >- the "Ok"-button does not close the options window, I have to use
    >"Cancel" to get out.
    >


    I'v seen this also:
    this must be a bug.


    Exception in Tkinter callback
    Traceback (most recent call last):
    File "C:\Python24\lib\lib-tk\Tkinter.py", line 1345, in __call__
    return self.func(*args)
    File "C:\Python24\lib\idlelib\configDialog.py", line 1197, in Apply
    self.ActivateConfigChanges()
    File "C:\Python24\lib\idlelib\configDialog.py", line 1185, in
    ActivateConfigCh
    anges
    instance.ResetKeybindings()
    File "C:\Python24\lib\idlelib\EditorWindow.py", line 585, in
    ResetKeybindings
    self.apply_bindings()
    File "C:\Python24\lib\idlelib\EditorWindow.py", line 837, in
    apply_bindings
    text.event_add(event, *keylist)
    File "C:\Python24\lib\lib-tk\Tkinter.py", line 1299, in event_add
    self.tk.call(args)
    TclError: bad event type or keysym "tab"
    Exception in Tkinter callback
    Traceback (most recent call last):
    File "C:\Python24\lib\lib-tk\Tkinter.py", line 1345, in __call__
    return self.func(*args)
    File "C:\Python24\lib\idlelib\configDialog.py", line 1192, in Ok
    self.Apply()
    File "C:\Python24\lib\idlelib\configDialog.py", line 1197, in Apply
    self.ActivateConfigChanges()
    File "C:\Python24\lib\idlelib\configDialog.py", line 1185, in
    ActivateConfigCh
    anges
    instance.ResetKeybindings()
    File "C:\Python24\lib\idlelib\EditorWindow.py", line 585, in
    ResetKeybindings
    self.apply_bindings()
    File "C:\Python24\lib\idlelib\EditorWindow.py", line 837, in
    apply_bindings
    text.event_add(event, *keylist)
    File "C:\Python24\lib\lib-tk\Tkinter.py", line 1299, in event_add
    self.tk.call(args)
    TclError: bad event type or keysym "tab"


    next time, I start:

    C:\Python24\Lib\idlelib>idle.py
    error reading package index file C:/Python24/tcl/tix8.1/pkgIndex.tcl:
    invalid co
    mmand name "lt}]}"
    Traceback (most recent call last):
    File "C:\Python24\Lib\idlelib\idle.py", line 21, in ?
    idlelib.PyShell.main()
    File "C:\Python24\lib\idlelib\PyShell.py", line 1355, in main
    if not flist.open_shell():
    File "C:\Python24\lib\idlelib\PyShell.py", line 275, in open_shell
    self.pyshell = PyShell(self)
    File "C:\Python24\lib\idlelib\PyShell.py", line 793, in __init__
    OutputWindow.__init__(self, flist, None, None)
    File "C:\Python24\lib\idlelib\OutputWindow.py", line 16, in __init__
    EditorWindow.__init__(self, *args)
    File "C:\Python24\lib\idlelib\EditorWindow.py", line 108, in __init__
    self.apply_bindings()
    File "C:\Python24\lib\idlelib\EditorWindow.py", line 837, in
    apply_bindings
    text.event_add(event, *keylist)
    File "C:\Python24\lib\lib-tk\Tkinter.py", line 1299, in event_add
    self.tk.call(args)
    _tkinter.TclError: bad event type or keysym "tab"

    (On Windows)
    I discovered, looking in C:\.idlerc\config-keys.cfg

    there was the entry
    dedent-region = <Shift-Key-tab>

    with an editor you can change it to uppercase:

    dedent-region = <Shift-Key-Tab>

    then it works again.

    HTH


    --
    Franz Steinhaeusler
    Franz Steinhaeusler, Oct 5, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Try Kret

    keybord event capture

    Try Kret, May 22, 2004, in forum: C Programming
    Replies:
    1
    Views:
    305
    Malcolm
    May 22, 2004
  2. Adriaan Renting
    Replies:
    1
    Views:
    358
    Franz Steinhaeusler
    Oct 12, 2005
  3. Steven Bethard
    Replies:
    3
    Views:
    303
    Peter Hansen
    Nov 19, 2005
  4. Tom Plunket

    textwrap.dedent replaces tabs?

    Tom Plunket, Dec 16, 2006, in forum: Python
    Replies:
    15
    Views:
    472
    Tom Plunket
    Dec 30, 2006
  5. Suraj Kurapati
    Replies:
    5
    Views:
    98
    Brian Candler
    Oct 21, 2008
Loading...

Share This Page