+ 2
I want to make a calculator in tkinter with .bind but there comes: AttributeError: 'NoneType' object has no attribute 'bind'
4 ответов
+ 2
Post your code so we can know more information about your code.
0
import tkinter
from tkinter import *
from math import *
def calculate (event):
...... equation = t.get ()
......t.delete (0,END)
......try:
........... t.insert (0, eval
(equation))
......except:
............. t.insert (0, "Invalid syntax)
Window = Tk ()
t= Entry (Window)
t.grid (row=0, columnspan= 4)
Window.title ("First Calculator")
Window.configure (background = "black")
calculate_field = Label (Window, text= " ", bg = ("white"), fg = "black") .grid(row=0, column=1)
Number_1 = tkinter.Button(Window, text= "1", bg = ("white"), fg = "black") .grid (row, column=0)
Number_2....
Number_3....
.........
Number_1.bind ("<Button-1>", lambda x: t.insert ( END, "1"))
Number_2....
Number_3....
0
All ok i fixed it