+ 2

I want to make a calculator in tkinter with .bind but there comes: AttributeError: 'NoneType' object has no attribute 'bind'

22nd Jul 2019, 11:54 AM
Jonas
Jonas - avatar
4 ответов
+ 2
Post your code so we can know more information about your code.
22nd Jul 2019, 11:59 AM
你知道規則,我也是
你知道規則,我也是 - avatar
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....
22nd Jul 2019, 12:22 PM
Jonas
Jonas - avatar
0
All ok i fixed it
22nd Jul 2019, 9:57 PM
Jonas
Jonas - avatar