【发布时间】:2017-07-04 14:46:32
【问题描述】:
TKINTER 显卡
from tkinter import *
tk = Tk()
btn = Button(tk, text="Click Me") #Makes a useless button
btn.pack() #Shows the button
import turtle #Makes the graphics work
t = turtle.Pen()
def hello(): #Makes button not
print('hello here')
btn = Button(tk, text="Click Me", command=hello)
当我点击按钮时程序应该说hello there,但我不能点击按钮,因为它不会响应。
【问题讨论】:
-
您好,欢迎来到 Stack Overflow,请花点时间通过 welcome tour 了解您在此处的方式(并获得您的第一个徽章),阅读如何创建 Minimal, Complete, and Verifiable example并检查How to Ask Good Questions,这样您就有机会获得反馈和有用的答案。
-
第二个按钮永远不会出现,因为你没有 pack() 它。第一个按钮出现,但单击时不调用函数,因此“不响应”。
标签: python python-3.x tkinter turtle-graphics