def inserter(entryblock, num):
entryblock.insert(-1, num)
I am making a calculator and whenever I click the number buttons on the calculator, it always inserts them at the beginning but I want to insert them to the end of the entry. How do I insert them at the right instead of the left?
The first argument to insert is the index at which to insert the text. Most often this is the index 0 (zero) to represent the beginning of the entry widget. The entry widget also supports the string literal "end" which represents the index immediately after the last character.
entryblock.insert("end", num)
For the canonical description of all supported indexes, see the section titled Indices in the tcl/tk man page for the Entry widget.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With