1 / 7
文档名称:

python中使用tkinter模块创建gui程序实例.doc

格式:doc   大小:106KB   页数:7页
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

python中使用tkinter模块创建gui程序实例.doc

上传人:86979448 2017/12/25 文件大小:106 KB

下载得到文件列表

python中使用tkinter模块创建gui程序实例.doc

相关文档

文档介绍

文档介绍:Python中使用Tkinter模块创建GUI程序实例
这篇文章主要介绍了Python中使用Tkinter模块创建GUI程序实例,本文给出了创建窗口、文本框、按钮等实例,需要的朋友可以参考下
使用Tkinter模块来创建简单的GUI程序。

Tkinter的Widgets有:Button、Canvas、Checkbutton、Entry、Frame、Label、Listbox、Menu、Menubutton、Message、Radiobutton、Scales、Scrollbar、TEXT、Toplevel等。

例:

复制代码代码如下:
# This program displays an empty window.
import Tkinter
def main():
main_window = ()
()
main()

例2:

复制代码代码如下:
import Tkinter
class MyGUI:
def __init__(self):
# Create the main window widget.
= ()

# Enter the Tkinter main loop.
()
# Create an instance of the MyGUI class.
my_gui = MyGUI()

例3:

复制代码代码如下:
# The program displays a label with text.
import Tkinter
class MyGUI:
def __init__(self):
= ()
# Create a Label widget containing the text 'Hello world'
= (, text='Hello World!')
# Call the Label widget's pack method.
()
# Enter the Tkinter main loop.
()
# Create an instance of the MyGUI class.
my_gui = MyGUI()

例4:

复制代码代码如下:
import Tkinter
class MyGUI:
def __init__(self):
= ()
= (,text='Hello World!')
= (,text='This is my GUI program.')