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 ...
随机推荐
- 全新Wijmo5中文学习指南正式上线
Wijmo 是一款使用 TypeScript 编写的新一代 JavaScript/HTML5 控件集.它秉承触控优先的设计理念,在全球率先支持 AngularJS,并且支持React.VueJS以及T ...
- visual studio 一些小技巧 整理
本博客将会陆续的整理一些作者在实际开发中的一些小技巧,一些挺有意思的东西,将会持续更新, 如果有问题,可以加群讨论,QQ群:592132877 #warning的使用 #warning 的意思是在程序 ...
- python基础第一章
Python基础 第一个python程序 变量 程序交互 基本数据类型 格式化输出 基本运算符 流程控制if...else... 流程控制-循环 第一个python程序 文件执行 1.用notepad ...
- linux vim 命令使用
基本上vim可以分为三种状态,分别是命令模式(command mode).插入模式(Insert mode)和底行模式(last line mode) 模式切换方法 在命令模式输入“i”,进入插入模式 ...
- 【Python】下载图片
import requests import bs4 import urllib.request import urllib import os hdr = {'User-Agent': 'Mozil ...
- apply函数应用
(1)找到数组中最小或最大的数字 var v = [1,23,4,9]; console.log(Math.min.apply(Math,v));
- hiho1523 数组重排2
时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 给定一个1-N的排列A1, A2, ... AN,每次操作小Hi可以选择一个数,把它放到数组的最左边. 请计算小Hi最少进 ...
- 颜色叠加模式:mix-blend-mode
文章转自叠加模式 http://www.cgspread.com/3551.html 注释:1.混合模式的数学计算公式,另外还介绍了不透明度.2.这些公式仅适用于RGB图像,对于Lab颜色图像而言,这 ...
- tomcat错误:The page you tried to access (/manager/login.do) does not exist
今天在idea上跑一个项目,所有配置都正常,其他接口测试也正常.唯独“/manage/user”接口在测试的时候后台没反应,也就是程序根本没往下走,postman测试显示如下: 浏览器范围url连接显 ...
- POJ2987 Firing 【最大权闭合图】
POJ2987 Firing Description You've finally got mad at "the world's most stupid" employees o ...