当前位置:网站首页>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 :

边栏推荐
- Subclasses call methods and properties of the parent class with the same name
- Are there any practical skills for operation and maintenance management
- go-etcd
- 下载Xshell和Xftp
- atguigu----脚手架--02-使用脚手架(2)
- C language implementation [minesweeping game] full version (implementation source code)
- How do the top ten securities firms open accounts? In addition, is it safe to open a mobile account?
- Reply and explanation on issues related to "online training of network security education in 2022"
- C# 读写自定义的Config文件
- 力扣——求一组字符中的第一个回文字符
猜你喜欢
![[Shenzhen IO] precise Food Scale (some understanding of assembly language)](/img/8c/1e64401e812538d8606df557054355.png)
[Shenzhen IO] precise Food Scale (some understanding of assembly language)
![Those high-frequency written tests and interview questions in [Jianzhi offer & Niuke 101] - linked list](/img/9a/44976b5df5567a7aff315e63569f6a.png)
Those high-frequency written tests and interview questions in [Jianzhi offer & Niuke 101] - linked list

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

redisson使用全解——redisson官方文檔+注釋(上篇)

Alibaba OSS postman invalid according to policy: policy condition failed: ["starts with", "key", "test/"]

2022年流动式起重机司机考试练习题及在线模拟考试

【编程强训】删除公共字符(哈希映射)+组队竞赛(贪心)

ctfshow-web355,356(SSRF)

Will Internet talents be scarce in the future? Which technology directions are popular?

2022茶艺师(初级)操作证考试题库及模拟考试
随机推荐
Redisson uses the full solution - redisson official documents + comments (Part 2)
C language implementation [minesweeping game] full version (implementation source code)
Cadence OrCAD capture "network name" is the same, but it is not connected or connected incorrectly. The usage of nodeName of liberation scheme
[R language] two /n data merge functions
Autosar 学习记录(1) – EcuM_Init
2022 operation of refrigeration and air conditioning equipment operation of national question bank simulated examination platform
C# Newtonsoft.Json中JObject的使用
下载Xshell和Xftp
微软宣布开源 (GODEL) 语言模型聊天机器人
热烈祝贺五行和合酒成功挂牌
长路漫漫、技术作伴
The triode is a great invention
[MySQL learning notes27] stored procedure
2022 test question bank and simulation test of tea master (primary) operation certificate
【技能】创建.bat快速打开网页
组件的自定义事件①
2022电工(中级)复训题库及答案
redisson使用全解——redisson官方文檔+注釋(上篇)
[chapter 72 of the flutter problem series] a solution to the problem that pictures taken in the flutter using the camera plug-in are stretched
华泰证券开户是安全可靠的么?怎么开华泰证券账户