You may also want to consider adding "Enter" as one of the keys to filter for. I also added in some additional code to prevent the cursor automatically jumping to the end if the backspace or the arrow keys are pressed.You could technically combine them into the same for loop, but I separated them for demonstration purposes. ![]() There are other more complicated forms, like text.markset(Tkinter.INSERT, '1.0 +100 chars') which goes to the hundreth char (counting newlines). row 5, where columns start at 0 and the first line is 1. Notice that the cursor logic is completely independent of the logic to add the dashes. Use text.markset(Tkinter.INSERT, '5.2') to move the cursor to column 2 in. I added code to prevent the cursor position from going out of sync with the dashes.Instead of hard-coding the dash positions, I abstracted them into their own list to make things a little less error-prone.This version is using a StringVar() so that it's possible to both grab and set the contents of the entry, rather then being confined to just inserting.# Increment the cursor if it falls on a dash The Tkinter Entry widget will help you to make a input box that take input from the user and this widget is very helpful if you want to make a form for your application. Raw = Ĭursor = (INSERT) # Gets the current cursor position Self.entry = Entry(textvariable=self.currentData) That way, no matter how many modifications are made, you will always add the dashes in the right spaces. Instead of inserting in the dashes on-the-fly, and suffering from desynchronization issues, a better solution would be to always start with a clean copy of the numbers, without any dashes, and then add them afterwards. Getting Scikit-Learn RandomForestClassifier to output Top N results.Incorporating feature error into the Random Forest algorithm. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |