tinui高级滑动条
Project description
TinUISheet
TinUI的高级滑动条控件。
[!NOTE]
tinuislider提供sliderlight和sliderdark两种样式配色。
CenterSlider
tinuislider.centerslider.CenterSlider
CenterSlider(
canvas: BasicTinUI,
pos: tuple,
width=200,
fg="#4554dc",
activefg="#4554dc",
bg="#868686",
buttonbg="#ffffff",
buttonoutline="#cccccc",
data=(1, 2, 3, 4, 5),
start=None, # 默认为中间索引
direction="x",
anchor="nw",
command=None,
)
参数与TinUI原生scalebar一致。
注意,
start是索引,不是值。
[!tip]
通过
CenterSlider.uid获取控件标识符,用于TinUI面板布局。其对面板布局的响应与原生scalebar一致。
select(num)
选中某一项索引。
disable(sign='#C8C8C8')
禁用,sign为禁用时标识色。
active_state()
激活控件。
get()
获取当前选中值。
set(value)
选中某一项值,需要在data中。
示例
from tkinter import Tk
from tinui import ExpandPanel, VerticalPanel
def on_resize(event):
rp.update_layout(10,10,event.width-10,event.height-10)
r=Tk()
ui=BasicTinUI(r)
ui.pack(fill='both',expand=True)
slider = CenterSlider(
canvas=ui,
pos=(0, 100),
width=200,
data=range(-10,11),
start=3, # start是索引,不是值,所以这里是选中数据中的第4项
anchor="center",
command=lambda v: print(f"Selected: {v}")
)
# 获取当前值
val = slider.get()
print(f"Current value: {val}")
slider.set(5) # 设置选中值为 5
print(f"Value after set: {slider.get()}")
rp = ExpandPanel(ui)
vp = VerticalPanel(ui)
rp.set_child(vp)
ep1 = ExpandPanel(ui)
vp.add_child(ep1, weight=1)
ep1.set_child(slider.uid)
ui.bind("<Configure>", on_resize)
r.mainloop()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tinuislider-1.0.0.tar.gz
(9.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tinuislider-1.0.0.tar.gz.
File metadata
- Download URL: tinuislider-1.0.0.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6857166d109b69690edd6c981f44597fa96f74bf3682205e5b24fd7a32c6e2f4
|
|
| MD5 |
15a0787a08b22435d479f5b9e8e51ba0
|
|
| BLAKE2b-256 |
680e1dfb0b2933cd7e568913985929c0d31d85ffc62d6cf409f8efb2ff34ea78
|
File details
Details for the file tinuislider-1.0.0-py3-none-any.whl.
File metadata
- Download URL: tinuislider-1.0.0-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7409865dc138980c759f823dcdecf26ca0900d5bbfb91b08dd12d70578e7f6e8
|
|
| MD5 |
d379638a9a25d238211705f6876981eb
|
|
| BLAKE2b-256 |
fcebca1df261d1627588f19543060b6996301ed629585bd3494d9f37d528f6a6
|