first my specs: python 3.6.1 windows 10 Well, i can´t figure out why these code gives me these error:
Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\Juan Diego\AppData\Local\Programs\Python\Python36\lib\tkinter__init__.py", line 1699, in call return self.func(*args) File "C:\Users\Juan Diego\Desktop\cosasque no son programas (miosno)\Test1 - copia.py", line 11, in run1 num= int(num_Entry.get()) AttributeError: 'NoneType' object has no attribute 'get'
I understand that python does not recognize num_Entry
as an Entry, but WHY?
import tkinter
import fractions
#declares the function
main= tkinter.Tk(className="main")
num_Entry =tkinter.Entry(main).pack()
den_Entry = tkinter.Entry(main).pack()
def run1():
global den_Entry
global num_Entry
num= int(num_Entry.get())
den= int(den_Entry.get())
den=int(input("denominator 1\n:-:->"))
Fraction1= fractions.Fraction(num,den)
print(Fraction1)
#runs the code
button = tkinter.Button(main, text="run!",command= run1).pack()
main.mainloop()`