当前位置:网站首页>Gui Gui programming (XV) - use scale to control font size changes
Gui Gui programming (XV) - use scale to control font size changes
2022-07-01 07:41:00 【Progress Xiaobai】
Thank you for opening Xiaobai's article
“ I hope you have made a little progress today , One step closer to a better life !”
Scale Move the slider
Scale( Move the slider ) Used in the specified value range , Move the slider to Select value .
Scale Widgets are used to implement python Application's graphical slider , So that the user can slide the value range displayed on the slider and select one of them . We can control the resolution of the minimum and maximum values as well as the scale . When the user is forced to select only one value from a given range of values , It provides Entry Alternatives to widgets .
Use
| SN | Options | explain |
| 1 | activebackground | The background color of the widget when it has focus . |
| 2 | bg | The background color of the widget . |
| 3 | bd | The border size of the widget . The default value is 2 Pixels . |
| 4 | command | Set the steps to call each time you move the slider . If the slider moves quickly , The callback is completed at the end . |
| 5 | cursor | The mouse pointer changes to the cursor type assigned to this option . It can be an arrow , Point etc . |
| 6 | digits | If the control variable used to control the proportional data is a string type , This option is used to specify the number of digits when converting the numeric scale to a string . |
| 7 | font | Font type of widget text . |
| 8 | fg | The foreground color of the text . |
| 9 | from_ | It is used to represent one end of the widget scope . |
| 10 | highlightbackground | Highlight color when the widget has no focus . |
| 11 | highlighcolor | Highlight color when widget has focus . |
| 12 | label | Can be set to some text , Can be displayed as a label with a ruler . If the scale is horizontal , Is displayed in the upper left corner ; If the scale is vertical , Is displayed in the upper right corner . |
| 13 | length | It represents the length of the widget . If the scale is horizontal , said X dimension ; If the scale is vertical , said y dimension . |
| 14 | orient | It can be set to horizontal or vertical according to the type of scale . |
| 15 | relief | It represents the type of boundary . The default value is FLAT. |
| 16 | repeatdelay | This option indicates the duration of pressing the button before the slider repeatedly starts moving in this direction . The default value is 300 millisecond . |
| 17 | resolution | Set to the minimum change in the scale value . |
| 18 | showvalue | By default , The scaled value is displayed in text . We can set this option to 0 With a prohibition label . |
| 19 | sliderlength | It represents the length of the slider window along the scale length . The default value is 30 Pixels . however , We can change it to an appropriate value . |
| 20 | state | By default ,scale Widget is active . We can set it to DISABLED To make it unresponsive . |
| 21 | takefocus | By default , The focus will cycle through the zoom widget . If we don't want this to happen , We can set this option to 0. |
| 22 | tickinterval | Proportional values are displayed in multiples of the specified tick interval . tickinterval The default value is 0. |
| 23 | to | It represents a floating-point or integer value , It specifies the other end of the range represented by the scale . |
| 24 | troughcolor | It represents the color of the passage . |
| 25 | variable | It represents the proportional control variable . |
| 26 | width | It represents the width of the penetration of the widget . |
Method
| SN | Method | explain |
| 1 | get() | It is used to get the current value of the scale . |
| 2 | set(value) | The value used to set the scale . |
Use Scale( Move the slider ) Control font size changes
from tkinter import *
root = Tk();root.geometry("400x150")
def test1(value):
print(" The value of the slider :",value)
newFont = (" Song style ",value)
a.config(font=newFont)
s1 = Scale(root,from_=10,to=50,length=200,tickinterval=5,orient=HORIZONTAL,command=test1)
s1.pack()
a = Label(root,text=" Progress Xiaobai ",width=10,height=1,bg="red",fg="white")
a.pack()
root.mainloop()
result :

边栏推荐
- Huawei modelarts training alexnet model
- Minecraft 1.16.5 module development (51) tile entity
- 【R语言】年龄性别频数匹配 挑选样本 病例对照研究,对年龄性别进行频数匹配
- 赌上了绩效,赢了公司CTO,我要搭DevOps平台!
- TCP/UDP 通信问题整理
- 十大劵商如何开户?另外,手机开户安全么?
- Solution to the problem that objects in unity2021 scene view cannot be directly selected
- Kickback -- find the first palindrome character in a group of characters
- Challenges faced by operation and maintenance? Intelligent operation and maintenance management system to help you
- Redisson utilise la solution complète - redisson Documents officiels + commentaires (Partie 1)
猜你喜欢

2022年茶艺师(中级)复训题库及答案

【深圳IO】精确食品称(汇编语言的一些理解)
![[programming compulsory training 3] find the longest consecutive number string in the string + the number that appears more than half of the times in the array](/img/5e/068268857b8c7c2065ba552fd23dbb.png)
[programming compulsory training 3] find the longest consecutive number string in the string + the number that appears more than half of the times in the array

LeetCode+ 71 - 75

2022 test question bank and simulation test of tea master (primary) operation certificate

Challenges faced by operation and maintenance? Intelligent operation and maintenance management system to help you

熱烈祝賀五行和合酒成功掛牌

组件的自定义事件①

AUTOSAR learning record (1) – ECUM_ Init

电脑有网络,但所有浏览器网页都打不开,是怎么回事?
随机推荐
【推荐系统】美团外卖推荐场景的深度位置交互网络DPIN的突破与畅想
Warm congratulations on the successful listing of five elements hehe liquor
MATLAB之基础知识
C language implementation [minesweeping game] full version (implementation source code)
[MySQL learning notes 28] storage function
Todolist classic case ①
[R language] age sex frequency matching select samples for case-control study, and perform frequency matching on age and sex
2022茶艺师(初级)操作证考试题库及模拟考试
【编程强训】删除公共字符(哈希映射)+组队竞赛(贪心)
ctfshow-web355,356(SSRF)
Oracle创建自增id
【mysql学习笔记27】存储过程
I bet on performance and won the CTO of the company. I want to build Devops platform!
C# 读写自定义的Config文件
Eigen矩阵运算库快速上手
AUTOSAR learning record (1) – ECUM_ Init
1286_FreeRTOS的任务优先级设置实现分析
[Shenzhen IO] precise Food Scale (some understanding of assembly language)
How do the top ten securities firms open accounts? In addition, is it safe to open a mobile account?
Kickback -- find the first palindrome character in a group of characters