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 ...
随机推荐
- mysql安装优化
安装centos7 安装mysql解决方案1 安装mariadb解决方案2 官网下载安装mysql-server时区批量配置编码远程连接my.cnf简版的参数说明核心配置参数升级版mysql存储引擎M ...
- 使用POI对excel进行操作生成二维数组
import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import ja ...
- HihoCoder 1055 : 刷油漆 树形DP第一题(对象 点)
刷油漆 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 上回说到,小Ho有着一棵灰常好玩的树玩具!这棵树玩具是由N个小球和N-1根木棍拼凑而成,这N个小球都被小Ho标上了 ...
- redis整合异常总结
问题:org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Property or field ' ...
- debug调试工具不显示的解决办法
清空在runtime目录下的debug目录下的文件即可.
- 相对导入中Attempted relative import in non-package问题
这一篇应该是解释的比较清楚: http://stackoverflow.com/questions/14664313/attempted-relative-import-in-non-package- ...
- log4j打印mybatis执行sql,将占位符换成真实的参数输出
背景: 在我日常码代码的时候,由于对mybatis的动态sql,比较依赖,并且有时候需求复杂,导致sql较长,而且参数众多,当出现问题是,需要将sql,放到navicat里面去执行查看结果,但是对于复 ...
- mysql执行导入导出数据源
mysql执行导入导出数据源 一.导出数据表结构 导出数据库建表的结构,不带数据,windows环境下,在cmd下,执行: mysqldump –no-data –u username –p* dat ...
- HDFS(一)
HDFS的概念 HDFS首先是文件系统(FileSystem,FS),尽管这个FS是基于OS原生的文件系统之上:而且这个文件系统是一个抽象概念,HDFS作为一个整体出现,对外(client)隐藏了其内 ...
- Oracle存储过程记录异常日志
一般我们会将一些涉及到数据库的定时任务直接用存储过程搞定,省去了后端代码的开发.部署,简单.快速,但这种方式存在一个弊端——当存储过程执行出错了,我们无法感知.解决办法也简单,学代码那样去捕获异常.打 ...