This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gpolo
Recipients ajaksu2, gpolo, jlgijsbers, kbk, netvigator, rhettinger
Date 2009-04-23.12:23:59
SpamBayes Score 0.00010826028
Marked as misclassified No
Message-id <ac2200130904230523w1f1744d0oe9bc28a87479991a@mail.gmail.com>
In-reply-to <1240487938.58.0.774023264425.issue1074333@psf.upfronthosting.co.za>
Content
> When numlock is on, it would still
> move one line up. We could change it to fix this problem, but then we
> would be using tk::TextUpDownLine which is marked as unsupported
> (basically everything that could help us in such situations is marked as
> unsupported).

Ah yes, here is something that would do what we wanted (for "up" only):

import Tkinter

def my_up(event):
    widget = event.widget
    if event.keysym == 'KP_Up' and event.state & 16:
        widget.tk.call('tk::TextInsert', widget, event.char)
        return "break"
    pos = widget.tk.call('tk::TextUpDownLine', widget, -1)
    widget.tk.call('tk::TextSetCursor', widget, pos)

text = Tkinter.Text()
text.event_add("<<Up>>", "<Key-Up>")
text.event_add("<<Up>>", "<Key-KP_Up>")
text.bind_class("Text", "<<Up>>", my_up)
text.pack()
text.mainloop()
History
Date User Action Args
2009-04-23 12:24:01gpolosetrecipients: + gpolo, rhettinger, kbk, jlgijsbers, netvigator, ajaksu2
2009-04-23 12:23:59gpololinkissue1074333 messages
2009-04-23 12:23:59gpolocreate