Here's My Code:
from tkinter import *
import hashlib
root=Tk()
root.title('iHash Checker')
root.geometry('322x425')
root.configure(background='white')
font='Alef'
primary_color='lightblue'
secondary_color='darkblue'
s1=Label(root,text='_____________________________',font=('Arial'),fg=secondary_color,bg='white').place(x=25,y=50)
logo=Label(root,text='Software Hash Checker',font=(font,18,'bold'),fg=secondary_color,bg='white').place(x=20,y=20)
input_paste=Entry(root,font=('Arial'),fg=secondary_color,bg='white',borderwidth=2,relief='solid').place(x=25,y=80,width=265)
input_paste_label=Label(root,text='Enter The Given Hash In The ZIP File',font=(font,8,'bold'),fg=secondary_color,bg='white').place(x=20,y=106)
input_original=Entry(root,font=('Arial'),fg=secondary_color,bg='white',borderwidth=2,relief='solid').place(x=25,y=130,width=265)
s2=Label(root,text='_____________________________',font=('Arial'),fg=secondary_color,bg='white').place(x=25,y=170)
input_original_label=Label(root,text='Enter The Exact Hash From The Official Site',font=(font,8,'bold'),fg=secondary_color,bg='white').place(x=20,y=160)
"""def output():
ip=input_paste.get()
io=input_original.get()
if ip == io:
result=Label(root,text='Right File',font=font,fg='darkgreen',bg='lightgreen').place(x=25,y=270,width=265)
elif ip != io:
result=Label(root,text='Wrong File',font=font,fg='darkred',bg='red').place(x=25,y=270,width=265)
pass"""
def output():
input_paste = input_paste.get()
input_original = input_original.get()
if input_paste == input_original:
result_label.config(text="Correct!")
else:
result_label.config(text="Wrong!")
btn=Button(root,bg=secondary_color,fg='white',borderwidth=0,relief='flat',font=font,text='Check',command=output).place(x=25,y=190,width=265)
result=Label(root,text='',font=font,fg=secondary_color,bg=primary_color).place(x=25,y=270,width=265)
root.mainloop()
It is throwing an error like this:
B:\Python_Projects\crypto>python gui-hash.py
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\soumy\anaconda3\lib\tkinter\__init__.py", line 1892, in __call__
return self.func(*args)
File "B:\Python_Projects\crypto\gui-hash.py", line 34, in output
input_paste = input_paste.get()
UnboundLocalError: local variable 'input_paste' referenced before assignment
B:\Python_Projects\crypto>python gui-hash.py
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\soumy\anaconda3\lib\tkinter\__init__.py", line 1892, in __call__
return self.func(*args)
File "B:\Python_Projects\crypto\gui-hash.py", line 42, in output
ip = input_paste.get()
AttributeError: 'NoneType' object has no attribute 'get'
Please find the error and slove. mostly from line 33 to 44.
Using libarieshashlib and tkinter
Running conda, python3 latest, pip
i want to see that when i write the data in two text input boxes, it will fetch the inputs and then check wether the first one matches with other. If so, then it will show success. If not then it will show malecious / don't run.
like this: MY IMAGIINATION:
if INPUT1 is equals to INPUT 2
then show "SUCCESS" in the box
else show "MALECIOUS / DON'T RUN" in the box
You have two problems.
First, you're chaining Entry() and place() together all in one step:
Because of this,
input_pasteis assigned to the return value of.place(), which is None.Instead, call
Entryas a first step, then callplace()afterwards:Second, in the
output()function, you're trying to completely replace theinput_pastevariable, so it would no longer be an Entry at all:Use some other variable name on the left. Call it
paste_textor something.