python3 Tkinter GUI 试水

Posted 点影

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python3 Tkinter GUI 试水相关的知识,希望对你有一定的参考价值。

from tkinter import * #导入tkinter下所有包,用于GUI开发
#窗口创建
tk=Tk()
cans=Canvas(tk,width=400,height=400)#定义窗口规格
cans.pack()
cans.create_line(0,0,600,600,fill=‘red‘) #画线
cans.create_arc(10,10,200,100) #画弧
def test():
print(‘GUI test‘)
btn=Button(tk,text=‘click me‘,command=test)
#显示界面

btn.pack()
#运行当前窗口

tk.mainloop()















以上是关于python3 Tkinter GUI 试水的主要内容,如果未能解决你的问题,请参考以下文章

Python3 GUI编程: 自带图形库 tkinter 学习教程

认真对待 Python3 收邮件

Python3.5、Win32gui、Tkinter。我无法从屏幕获取 Pixel

Python3 GUI编程: 自带图形库 tkinter 学习教程

Python3 - 函数以及GUI_TKINTER(第四天)

使用python3在Raspberry Pi上打开和关闭Tkinter GUI