py库: GUI(tkinter)

时间:2023-11-15 15:46:50

图形用户界面(Graphical User Interface,简称 GUI)

http://www.runoob.com/python/python-gui-tkinter.html  Python GUI编程(Tkinter) —— 菜鸟教程

随便看看:

http://www.cnblogs.com/joechinochl/articles/7485709.html  八款常用的 Python GUI 开发框架

http://www.cnblogs.com/monsteryang/p/6558693.html  python GUI编程(Tkinter)

http://www.cnblogs.com/monsteryang/p/6558904.html  简单的python GUI例子


注意:Python3.x 版本使用的库名为 tkinter,即首写字母 T 为小写。

import tkinter

例子1:

from tkinter import *

def on_click():
label['text'] = text.get() root = Tk(className='hello')
root.minsize(600, 400) label = Label(root, text="your message")
label.pack() text = StringVar()
text.set('请输入:')
entry = Entry(root)
entry['textvariable'] = text
entry.pack() frame = Frame(root)
frame.pack()
Button(frame, text="QUIT", fg="red", command=frame.quit).pack(side=RIGHT)
Button(frame, text="change", fg="blue", command=on_click).pack(side=LEFT) root.mainloop()

...