Why does a black circle appear instead of the backspace when trying to display an Entry '\b' ?
Code:
if key == 'BS': calc_entry.insert(END, '\b') Something like this can be implemented in a slightly different way.
import tkinter def backspace(): entry_text.delete(len(entry_text.get())-1) root = tkinter.Tk() entry_text = tkinter.Entry(root) entry_text.insert(0, '1234567890') entry_text.pack() bs = tkinter.Button(root, text='BS', command=backspace) bs.pack() root.mainloop() To delete a character before the cursor position (as the backspace key does), you can use the 'insert' position:
#!/usr/bin/env python3 import tkinter.ttk root = tkinter.Tk() entry = tkinter.ttk.Entry(width=30) entry.insert(0, "press BS to emulate <Backspace> key") entry.pack() tkinter.ttk.Button( text="BS", command=lambda: entry.delete(entry.index(tkinter.INSERT) - 1)).pack() root.mainloop() Source: https://ru.stackoverflow.com/questions/775973/
All Articles
BSsymbol) Theitertools.cycle()loop does not work using\bin PyCharm - jfs