tkinter_calc_ii
This is an old revision of the document!
TKInter Calc II
Binding
For example, you may wish to bind a key to a button. This helps you streamline the control of an application. If you just have two input methods there could be a problem with things like arrows and backspace or delete messing up the calculator window.
import tkinter as tk from tkinter import ttk def press_eq(event): print('Equals key pressed.') root = tk.Tk() button1 = ttk.Button(root, text='=') button1.bind('<Return>', press_eq) button1.focus() button1.pack(expand=True) root.mainloop()
tkinter_calc_ii.1713573405.txt.gz · Last modified: 2024/04/20 00:36 by appledog