python - 当我运行此代码时,会出现一个没有按钮的空白 Tkinter 窗口
问题描述
from tkinter import *
root = Tk()
def printName(event):
name = input("what is your name?")
print("My name is" + name)
printButton = Button(root,text = "Cliek Me")
printButton.bind("<Button-1>",printNme)
printButton.pack()
root.mainloop()
解决方案
下面的代码应该可以解决您的问题。根据代码的要求填写引号内的空白。
from tkinter import *
root = Tk()
def printName():
name = input("what is your name?")
print("My name is" + "")
printButton = Button(root, text="Cliek Me")
printButton.bind("<Button-1>", "")
printButton.pack()
root.mainloop()
printName()
推荐阅读
- html - 如何以角度管理组件之间的空间
- wordpress - 如何在可变产品woocommerce中添加自定义价格
- mysql - MYSQL 不是 OR 是 NULL
- java - 如何恢复 Spring Boot 1.5 中的默认异常映射?
- excel - 需要过滤数据中更改单元格的单元格地址
- visual-studio - Devenv 命令和密码
- publish - github不会为我发布,你能窥探我做错了什么吗
- xml - 验证缺少的标签 xQuery
- r - 无法让 kmeans 工作?
- node.js - Google Cloud Node js 部署问题:(gcloud.app.deploy)错误响应:[9]