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 Todd.Rovito
Recipients Rich.Rauenzahn, Todd.Rovito, dzabel, loewis, roger.serwy, terry.reedy
Date 2013-03-30.18:21:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1364667676.15.0.326863304606.issue14146@psf.upfronthosting.co.za>
In-reply-to
Content
I created a small test program trying to reproduce the problem on Windows 7, Python 3.4, and TK 8.6.  Unfortunately it works fine and each line is highlighted as a user presses ctrl-B.  I got the select code straight from IDLE.  Any other ideas Roger?  This might be an IDLE bug after all.

from tkinter import *

class SelectTest:
    def __init__(self):
        self.mainwin = Tk()
        # Create a text widget
        # idle creates the text widget like this
        #self.text = text = MultiCallCreator(Text)(text_frame, **text_options)
        self.textbox = Text(self.mainwin, width=80, height=10)
        self.textbox.pack()

        # Add some text
        self.textbox.insert(INSERT, "line 1: Select some text\n")
        self.textbox.insert(INSERT, "line 2: Select some text\n")
        self.textbox.insert(INSERT, "line 3: Select some text\n")
        self.textbox.insert(INSERT, "line 4: Select some text\n")

        # Add the binding
        self.textbox.bind("<Control-Key-b>", self.select_just_like_idle)
        # just in case caps lock is on
        self.textbox.bind("<Control-Key-B>", self.select_just_like_idle)
        self.lineno = 1
	
    def select_just_like_idle(self, event):
        print("Select just like idle was called")
        if self.lineno is not None and self.lineno > 0:
            self.textbox.mark_set("insert", "%d.0" % self.lineno)
            self.textbox.tag_remove("sel", "1.0", "end")
            self.textbox.tag_add("sel", "insert", "insert +1l")
            self.lineno = self.lineno + 1


if __name__ == "__main__":
    # Start the program
    selectIDLETest = SelectTest()
    selectIDLETest.mainwin.mainloop()
History
Date User Action Args
2013-03-30 18:21:16Todd.Rovitosetrecipients: + Todd.Rovito, loewis, terry.reedy, roger.serwy, Rich.Rauenzahn, dzabel
2013-03-30 18:21:16Todd.Rovitosetmessageid: <1364667676.15.0.326863304606.issue14146@psf.upfronthosting.co.za>
2013-03-30 18:21:16Todd.Rovitolinkissue14146 messages
2013-03-30 18:21:15Todd.Rovitocreate