Tkinter Spinbox
语法:
这里是一个简单的语法来创建这个widget:
w = Spinbox( master, option, ... )
参数:
master: 这代表了父窗口.
options: 下面是这个小工具最常用的选项列表。这些选项可以作为键 - 值对以逗号分隔.
Option | Description |
---|---|
activebackground | The color of the slider and arrowheads when the mouse is over them. |
bg | The color of the slider and arrowheads when the mouse is not over them. |
bd | The width of the 3-d borders around the entire perimeter of the trough, and also the width of the 3-d effects on the arrowheads and slider. Default is no border around the trough, and a 2-pixel border around the arrowheads and slider. |
command | A procedure to be called whenever the scrollbar is moved. |
cursor | The cursor that appears when the mouse is over the scrollbar. |
disabledbackground | The background color to use when the widget is disabled. |
disabledforeground | The text color to use when the widget is disabled. |
fg | Text color. |
font | The font to use in this widget. |
format | Format string. No default value. |
from_ | The minimum value. Used together with to to limit the spinbox range. |
justify | Default is LEFT |
relief | Default is SUNKEN. |
repeatdelay | Together with repeatinterval, this option controls button auto-repeat. Both values are given in milliseconds. |
repeatinterval | See repeatdelay. |
state | One of NORMAL, DISABLED, or "readonly". Default is NORMAL. |
textvariable | No default value. |
to | See from. |
validate | Validation mode. Default is NONE. |
validatecommand | Validation callback. No default value. |
values | A tuple containing valid values for this widget. Overrides from/to/increment. |
vcmd | Same as validatecommand. |
width | Widget width, in character units. Default is 20. |
wrap | If true, the up and down buttons will wrap around. |
xscrollcommand | Used to connect a spinbox field to a horizontal scrollbar. This option should be set to the set method of the corresponding scrollbar. |
方法:
spinbox对象有这些方法:
Methods & Description |
---|
delete(startindex [,endindex]) This method deletes a specific character or a range of text. |
get(startindex [,endindex]) This method returns a specific character or a range of text. |
identify(x, y) Identifies the widget element at the given location. |
index(index) Returns the absolute value of an index based on the given index. |
insert(index [,string]...) This method inserts strings at the specified index location. |
invoke(element) Invokes a spinbox button. |
例子:
自行尝试下面的例子:
from Tkinter import * master = Tk() w = Spinbox(master, from_=0, to=10)
w.pack() mainloop()
这将产生以下结果:
Tkinter Spinbox的更多相关文章
- tkinter中spinbox递增和递减控件(十)
spinbox递增和递减控件 import tkinter wuya = tkinter.Tk() wuya.title("wuya") wuya.geometry("3 ...
- tkinter python(图形开发界面)
Tkinter模块("Tk 接口")是Python的标准Tk GUI工具包的接口.Tk和Tkinter可以在大多数的Unix平台下使用,同样可以应用在Windows和Macinto ...
- gui - tkinter 开发
GUI 用户交互界面 tkinter 介绍 tkinter python自带的gui库,对图形图像处理库tk的封装 其他gui:pythonwin,wxpython,pyQT.. 概念介绍 组件:组成 ...
- tkinter python(图形开发界面) 转自:渔单渠
Tkinter模块("Tk 接口")是Python的标准Tk GUI工具包的接口.Tk和Tkinter可以在大多数的Unix平台下使用,同样可以应用在Windows和Macinto ...
- python中的Tkinter模块
Tkinter模块("Tk 接口")是Python的标准Tk GUI工具包的接口.Tk和Tkinter可以在大多数的Unix平台下使用,同样可以应用在Windows和Macinto ...
- python3.8 新特性
https://docs.python.org/3.8/whatsnew/3.8.html python 3.8的新功能本文解释了与3.7相比,python 3.8中的新特性. 有关完整的详细信息,请 ...
- python-tkinter使用方法——转载(二)
转载URL:https://www.cnblogs.com/yudanqu/p/9467803.html Tkinter模块("Tk 接口")是Python的标准Tk GUI工具包 ...
- python_tkinter组件
1.按钮 # 按钮 # bg设置背景色 btn = tkinter.Button(root,text = '按钮',bg = 'red') btn.pack() # fg设置前景色(文字颜色) btn ...
- Python笔记_第四篇_高阶编程_GUI编程之Tkinter_2.控件类
1. Label控件: 说明:标签控件,可显示文本 图示1: 实例1: import tkinter # 创建主窗口__编程头部 win = tkinter.Tk() # 设置标题 win.title ...
随机推荐
- JavaScript class 使用
/********************************************************************* * JavaScript class 使用 * 说明: * ...
- Git详解之十 Git常用命令
下面是我整理的常用 Git 命令清单.几个专用名词的译名如下. Workspace:工作区 Index / Stage:暂存区 Repository:仓库区(或本地仓库) Remote:远程仓库 一. ...
- 关于dyld: Library not loaded
在接入智凡迪的sdk过程中,遇到以下问题: dyld: Library not loaded: @rpath/SDKFramework.framework/SDKFramework Referen ...
- GCD基础
一.GCD介绍 1.what is GCD? Grand Central Dispatch 中枢调度器.用很简单的方式实现了极为复杂繁琐的多线程编程.异步执行任务的技术之一. 2.GCD存在于li ...
- 解决 git 错误 error: RPC failed; curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 11
环境 Windows 7 . git push 时出现错误,无法提交代码到远程仓库. Counting objects: , done. Delta compression using up to t ...
- BZOJ2588 SPOJ10628 Count on a tree 【主席树】
BZOJ2588 Count on a tree 题目描述 给定一棵N个节点的树,每个点有一个权值,对于M个询问(u,v,k),你需要回答u xor lastans和v这两个节点间第K小的点权.其中l ...
- PHP匹配Email、URL、IP
/* * 正则表达式匹配 */ $email = '137813369@qq.com'; $regex = '/\w+([−+.]\w+)*@\w+([−.]\w+)*\.\w+([−.]\w+)*/ ...
- 转发 Java火焰图在Netflix的实践
为了分析不同软件或软件的不同版本使用CPU的情况,相关设计人员通常需要进行函数的堆栈性能分析.相比于定期采样获得数据的方式,利用定时中断来收集程序运行时的PC寄存器值.函数地址以及整个堆栈轨迹更加高效 ...
- Python 函数 -range()
range() pytho range() 函数可创建一个整数列表,一般用在 for 循环中. 语法: range(start, stop[, step]) start: 计数从 start 开始.默 ...
- BZOJ3261:最大异或和
浅谈\(Trie\):https://www.cnblogs.com/AKMer/p/10444829.html 题目传送门:https://lydsy.com/JudgeOnline/problem ...