Python Tkinter编程
声明:主要是为了自己方便,所以把别人的教程搬到这里来,没有其他的意思.
如果有侵犯您的权益,请联系我QQ:3121922008
我会在第一时间妥善处理,抱歉.
还有其他的一些搜集的资源连接放在http://www.flask.pub
有兴趣的朋友不妨移驾一览.
Tkinter 编程:
TkInter是标准的Python GUI库。的Python与Tkinter的结合提供了一个快速和容易的方法来创建GUI应用程序。 Tkinter的提供了一个强大的面向对象的接口Tk的GUI工具包.
使用Tkinter创建一个GUI应用程序是一件容易的事。所有你需要做的是执行以下步骤:
导入Tkinter模块.
创建GUI应用程序的主窗口.
添加上述部件之一或更多的GUI应用程序.
进入主事件循环的由用户触发每个事件响应.
例子:
#!/usr/bin/python import Tkinter
top = Tkinter.Tk()
# Code to add widgets will go here...
top.mainloop()
这将创建一个下面的窗口:
Tkinter的部件:
Tkinter的提供各种控件,如按钮,标签和文本框,一个GUI应用程序中使用。这些控件通常被称为部件.
目前有15种Tkinter的部件。我们提出这些部件以及一个简短的介绍,在下面的表:
Operator | Description |
---|---|
Button | The Button widget is used to display buttons in your application. |
Canvas | The Canvas widget is used to draw shapes, such as lines, ovals, polygons, and rectangles, in your application. |
Checkbutton | The Checkbutton widget is used to display a number of options as checkboxes. The user can select multiple options at a time. |
Entry | The Entry widget is used to display a single-line text field for accepting values from a user. |
Frame | The Frame widget is used as a container widget to organize other widgets. |
Label | The Label widget is used to provide a single-line caption for other widgets. It can also contain images. |
Listbox | The Listbox widget is used to provide a list of options to a user. |
Menubutton | The Menubutton widget is used to display menus in your application. |
Menu | The Menu widget is used to provide various commands to a user. These commands are contained inside Menubutton. |
Message | The Message widget is used to display multiline text fields for accepting values from a user. |
Radiobutton | The Radiobutton widget is used to display a number of options as radio buttons. The user can select only one option at a time. |
Scale | The Scale widget is used to provide a slider widget. |
Scrollbar | The Scrollbar widget is used to add scrolling capability to various widgets, such as list boxes. |
Text | The Text widget is used to display text in multiple lines. |
Toplevel | The Toplevel widget is used to provide a separate window container. |
Spinbox | The Spinbox widget is a variant of the standard Tkinter Entry widget, which can be used to select from a fixed number of values. |
PanedWindow | A PanedWindow is a container widget that may contain any number of panes, arranged horizontally or vertically. |
LabelFrame | A labelframe is a simple container widget. Its primary purpose is to act as a spacer or container for complex window layouts. |
tkMessageBox | This module is used to display message boxes in your applications. |
标准属性:
让我们来看看如何他们的一些共同的属性。如大小,颜色和字体指定.
几何管理:
Tkinter的部件有特定几何形状的管理方法,整个小部件父控件区域组织的目的。 Tkinter的公开以下几何经理类:包装,网格,位置.
Python Tkinter编程的更多相关文章
- python Tkinter 编程
Tkinter 是 Python 的标准 GUI 库.Python 使用 Tkinter 可以快速的创建 GUI 应用程序. 由于 Tkinter 是内置到 python 的安装包中.只要安装好 Py ...
- python界面Tkinter编程(tkMessageBox对话框使用)
python界面Tkinter编程(tkMessageBox对话框使用) 转载 https://blog.csdn.net/m_buddy/article/details/80105154 1 ...
- Python: Tkinter、ttk编程之计算器
起源: 研究Python UI编程,我偏喜欢其原生组件,于是学习Tkinter.ttk组件用法.找一计算器开源代码,略加修整,以为备忘.其界面如图所示: 1.源代码(Python 2.7): # en ...
- Python GUI编程(Tkinter) windows界面开发
Python实现GUI简单的来说可以调用Tkinter库,这样一般的需求都可以实现,显示简单的windows窗口代码如下: python_gui.py 1 #!C:\Python27\python.e ...
- python GUI编程tkinter示例之目录树遍历工具
摘录 python核心编程 本节我们将展示一个中级的tkinter应用实例,这个应用是一个目录树遍历工具:它会从当前目录开始,提供一个文件列表,双击列表中任意的其他目录,就会使得工具切换到新目录中,用 ...
- Python -- Gui编程 -- Tkinter的使用 -- 对话框消息框
1.消息框 tkMessageBox.py import tkinter from tkinter import messagebox def cmd(): global n global butto ...
- python Tkinter接受键盘输入并保存文件
最近想用python写个切换host的小工具,折腾了好几天,终于实现了第一步. 采用Tkinter编程,text控件接受输入,然后点击save按钮,保存内容到当前文件夹下,文件名为hostb,如下两张 ...
- Python GUI编程实践
看完了<python编程实践>对Python的基本语法有了一定的了解,加上认识到python在图形用户界面和数据库支持方面快捷,遂决定动手实践一番. 因为是刚接触Python,对于基本的数 ...
- Python GUI编程各种实现的对比
Python GUI编程各种实现的对比 从 Python 语言的诞生之日起,就有许多优秀的 GUI 工具集整合到 Python 当中,这些优秀的 GUI 工具集,使得 Python 也可以在图形界面编 ...
随机推荐
- ios 10.3下载 Xcode8配置支持 ios 10.3下载
一不小心,手机又升级了,哎
- jquery-ui 拖拽排序
: 引入 <script src="//code.jquery.com/jquery-1.9.1.js"></script> <script sr ...
- 诗·想——日记&断章
日记 海子 姐姐,今夜我在德令哈,夜色笼罩 姐姐,我今夜只有戈壁 草原尽头我两手空空 悲痛时握不住一颗泪滴 姐姐,今夜我在德令哈 这是雨水中一座荒凉的城 除了那些路过的和居住的 德令哈... ...
- 【测试技术】websocket-client
Websocket Client 继续上周的议题.因为我不会写go,不会写websocket客户端,导致整个测试过程我是个完美的酱油党.上周我终于把客户端服务写好了. 选择Websokcet框架 现在 ...
- GCD基础
一.GCD介绍 1.what is GCD? Grand Central Dispatch 中枢调度器.用很简单的方式实现了极为复杂繁琐的多线程编程.异步执行任务的技术之一. 2.GCD存在于li ...
- 51nod 1347 旋转字符串
S[0...n-1]是一个长度为n的字符串,定义旋转函数Left(S)=S[1…n-1]+S[0].比如S=”abcd”,Left(S)=”bcda”.一个串是对串当且仅当这个串长度为偶数,前半段和后 ...
- 使用dnSpy对目标程序(EXE或DLL)进行反编译修改并编译运行
本文为原创文章.源代码为原创代码,如转载/复制,请在网页/代码处明显位置标明原文名称.作者及网址,谢谢! 本文使用的工具下载地址为: https://github.com/cnxy/dnSpy/arc ...
- 在一个form中有两个submit,值分别为修改和删除,如何在提交时用js判断submit值为修改还是删除呢
同一个form里,不管哪个 submit 都是直接提交form表单里的内容. 要达到你的目的,就不能用类型为 submit 的按钮,要用 button,然后加onclick 方法来自定义预处理参数,然 ...
- table样式的下拉框(angularjs)
前言 虽然使用的技术比较老了,但是思想却还是适用于现在的vue等框架. 一:实现的样式 二:实现包括的功能点 1:下拉框内容是表格,类似于一个弹窗 表格内容最多六行,超出的显示滚动条,表头固定,可滚动 ...
- coding 绑定腾讯云开放平台注意事项
coding升级后需要绑定腾讯云开放平台,按照coding文档的提示操作就好 1.创建腾讯云平台后,不要自定义邮箱和用户名 2.直接绑定原来我们使用的coding账号即可 绑定成功后,邮箱和用户名会自 ...