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 ...
随机推荐
- [Linux] find文件查找和grep文件内容查找
在使用linux时,经常需要进行文件查找.其中查找的命令主要有find和grep.两个命令是有区别的: (1)find命令:根据文件的属性进行查找,如文件名,文件大小,所有者,所属组,是否为空,访问时 ...
- iOS中数组遍历的方法及比较
数组遍历是编码中很常见的一种需求,我们来扒一拔iOS里面都有什么样的方法来实现,有什么特点. 因为ios是兼容C语言的,所以c语言里面的最最常见的for循环遍历是没有问题的. 本文中用的数组是获取的系 ...
- BZOJ4036:按位或 (min_max容斥&高维前缀和)
Description 刚开始你有一个数字0,每一秒钟你会随机选择一个[0,2^n-1]的数字,与你手上的数字进行或(c++,c的|,pascal 的or)操作.选择数字i的概率是p[i].保证0&l ...
- BZOJ4540 Hnoi2016 序列 【莫队+RMQ+单调栈预处理】*
BZOJ4540 Hnoi2016 序列 Description 给定长度为n的序列:a1,a2,-,an,记为a[1:n].类似地,a[l:r](1≤l≤r≤N)是指序列:al,al+1,-,ar- ...
- python 抓取网页一部分
import re import requests from bs4 import BeautifulSoup response = requests.get("https://jecvay ...
- 小波分解和合成的simulink仿真
采用5-3提升小波的方法 小波分解 数据拆分 预测 更新 数据输出使能电路 电路共有两个输入三个输出,in1是数据输入,in2是输入数据有效信号,out1是更新后的低频信号,out2是预测的高频信号, ...
- Linux环境下安装Websphere8.5.5
首先安装包资源: https://pan.baidu.com/s/1Jvkqe3WMgNQ3bn3ggYGhAQ 下面是Installation Manager安装包 agent.installer. ...
- [LeetCode系列]有序链表转换为平衡BST的递归解法
给定有序链表(元素由小到大), 试问如何将其转换为一个平衡BST? 平衡BST: 任意节点的左右子树的深度差值不大于1. 主要思想是用递归. Trick是使用快慢指针来获取中间节点. 获得中间节点后, ...
- bzoj 3671 [Noi2014]随机数生成器——贪心(时间复杂度分配)
题目:https://www.lydsy.com/JudgeOnline/problem.php?id=3671 设 x 为一个点的行号, y 为一个点的列号:原本想着判断一个点能不能选就是看选了的点 ...
- jdk1.8新特性之lambda表达式
lambda表达式其实就是指一个匿名函数,应用最广泛的就是匿名内部类的简化.在jdk1.8之前,我们定义一个匿名内部类可能需要写一大坨代码,现在有了lambda之后,可以写的很简洁了.但不是说lamb ...