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 ...
随机推荐
- SPU - SKU - ARPU
商品和单品: 单品:汉语中的“个” 例如,iphone是一个单品,但是在淘宝上当很多商家同时出售这个产品的时候,iphone就是一个商品了 商品:淘宝叫item,京东叫product,商品特指与商家 ...
- python学习之多线程(二)
使用multiprocessing 使用multiprocessing.dummy 单使用multiprocessing模块的指的是多进程,使用multiprocessing.dummy则表示使用的是 ...
- Windows2012启动自动帐户登陆
Win+R 启动 输入regedit 运行注册表 找到[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogo ...
- 语义耦合(Semantic Coupling)
跟小伙伴一起重构一段 UI,试图将用户界面和业务代码分离的时候,小伙伴试图在业务代码中直接调用 UI.我们当然都知道这会产生耦合,于是小伙伴试图定义一些属性.变量或接口来解决这个耦合.虽然在代码的静态 ...
- Asp.net Global 定时执行
在复杂的业务应用程序中,有时候会要求一个或者多个任务在一定的时间或者一定的时间间隔内计划进行,比如定时备份或同步数据库,定时发送电子邮件,定期处理用户状态信息,支付系统中定期同步异常账单等等,我们称之 ...
- direct2d封装
图片项目
- hessian协议原理
Hessian 原理分析 一. 远程通讯协议的基本原理 网络通信需要做的就是将流从一台计算机传输到另外一台计算机,基于传输协议和网络 IO 来实现,其中传输协议比较出名的有 http . t ...
- ballerina 学习九 Client endpoints
说白了就是连接外部服务的,可以是http jms websocket .... 简单例子 代码 import ballerina/http; import ballerina/log; endpoin ...
- vue a href="tel" 拨打电话
走默认的方式失败 <a href="tel:{{telPhone}}">{{telPhone}}</a> 走字符串拼接方法成功 <a :href=&q ...
- undefined vs. null
undefined vs. null 一.相似性 在JavaScript中,将一个变量赋值为undefined或null,老实说,几乎没区别. var a = undefined; var a = n ...