我是编程新手,从python和Tkinter开始。 我在线观看了这个教程视频,在试图理解它的同时,我完全按照教程中的那个家伙所做的那样编写了代码。但是,我遇到语法错误,无法运行它screenshot
对不起,这是我在这里的第一篇文章。好的,下面是代码:
from tkinter import *
#key down function
def click():
entered_text=textentry.get() #this will collect the text from the text entry box
output.delete(0,0, END)
try:
definition = my_compdictionary[entered_text]
except:
definition = "Sorry there is no word like that , try again"
output.insert(END, definition)
#MAIN
window = Tk()
window.title("My computer Science Glosarry")
#MY PHOTO
photo1 = PhotoImage(file="C:/Users/zahar/Desktop/photo2.gif")
Label (window, image=photo1, bg="black") .grid(row=0, column=0, sticky=E)
# create label
Label = (window, text="Enter a word you would like a definition for:", bg="black", fg="white", font="none 12 bold") .grid(row1, column=0, sticky=W)
你错过了什么:)
#
相关问题 更多 >
编程相关推荐