Python 为什么';t tkinter识别命令?
我正在学习制作一个Mad Libs生成器,除创建按钮外,我已经完成了大部分工作。由于某些原因,无法识别命令。我使用Pycharm是因为我的笔记本电脑不允许我pip安装东西(相信我,我已经尝试过多次修复它。它只是不想)并且无法安装常规的tkinter,所以我有Tkintereasy。它说它在init下定义的命令不起作用。代码如下:Python 为什么';t tkinter识别命令?,python,debugging,tkinter,Python,Debugging,Tkinter,我正在学习制作一个Mad Libs生成器,除创建按钮外,我已经完成了大部分工作。由于某些原因,无法识别命令。我使用Pycharm是因为我的笔记本电脑不允许我pip安装东西(相信我,我已经尝试过多次修复它。它只是不想)并且无法安装常规的tkinter,所以我有Tkintereasy。它说它在init下定义的命令不起作用。代码如下: def madlib1(): animal = input('Please enter an animal: ') noun = input('Plea
def madlib1():
animal = input('Please enter an animal: ')
noun = input('Please enter a noun: ')
place = input('Please enter a place: ')
age = input('Please enter an age: ')
color = input('Please enter a color: ')
adjective = input('Please enter an adjective: ')
noun2 = input('Please enter a noun: ')
verb = input('Please enter a verb: ')
adverb = input('Please enter an adverb: ')
print(
"The wild and ferocious " + animal + " eats plenty of " + noun + " to stay strong and survive in the " + place + ". " +
"\n The" + animal + " lives to be the ripe old age of " + age + "." +
"\n They come in many colors, but primarily, you will see them as " + color + ". " +
"They typically take refuge in the" + adjective + noun2 + " where they " + verb + " in a very " + adverb + " manner.")
# Madlib 2: The professional
def madlib2():
profession = input('Please enter a profession: ')
adjective = input('Please enter an adjective: ')
noun = input('Please enter a noun: ')
celebrity = input('Please enter a celebrity name: ')
adjective2 = input('Please enter an adjective: ')
verbing = input('Please enter a verb ending in ing')
print("Have you ever considered " + profession + " to be your profession? "
"\nThis new " + adjective + " career is the new in demand craze among all the " + noun + ". "
"\nIf you don't believe me, just ask " + celebrity + ". "
"\nThis new" + adjective2 + " job has got me " + verbing + " in my seat!")
Button(root, text='The ferocious animal', font='arial 15', command=madlib1,
bg='ghost white').place(x=60, y=120)
Button(root, text='The professional', font='arial 15', commmand=madlib2,
bg='ghost white').place(x=70, y=180)
root.mainloop()
简单的打字错误
第二个按钮有3个“m”的命令:
Button(root, text='The ferocious animal', font='arial 15', command=madlib1, bg='ghost white').place(x=60, y=120)
Button(root, text='The professional', font='arial 15', command=madlib2, bg='ghost white').place(x=70, y=180) # fixed
哦,天哪,谢谢you@RomanAgne~如果这有帮助,请确保将此标记为正确答案。单击查看如何标记为答案。