品易云推流 关闭
文章详情页
文章 > Python常见问题 > 怎么用python写窗口程序

怎么用python写窗口程序

头像

silencement

2020-03-19 13:52:147812浏览 · 0收藏 · 0评论

Python也可以创建界面,需要导入tkinter
具体看代码:

from tkinter import *

def btnClick():
    textLabel['text']='我点击了按钮'

root = Tk(className="我的第一个窗口程序");

textLabel = Label(root,text = '提示显示',justify=LEFT,padx=10)
textLabel.pack(side = TOP)

btn = Button(root)
btn['text']='点击测试'
btn['command'] = btnClick
btn.pack(side = BOTTOM)

mainloop()

更多技术请关注python视频教程

关注

关注公众号,随时随地在线学习

本教程部分素材来源于网络,版权问题联系站长!

底部广告图