当我尝试以这种方式返回时,编译器将引发错误。
编译消息Main.java:15:错误:缺少返回语句 } ^ 1错误退出状态1
from tkinter import *
from tkinter.ttk import *
def process_name():
"""Do something with the name (in this case just print it)"""
global name_entry
print("Hi {}".format(name.get()))
def main():
"""Set up the GUI and run it"""
global name_entry
window = Tk()
name_label = Label(window, text='Enter name a name below:')
name_label.grid(row=0, column=0)
name_entry = Entry(window)
name_entry.grid(row=1, column=3)
button = Button(window, text='Say hello', command=process_name, padding=10)
button.grid(row=1, column=0, columnspan=2)
window.mainloop()
main()
代码的其余部分。
答案 0 :(得分:0)
将最后一个 else if 'else if(distanceB == distanceA)'转换为 else ,它应该可以工作