TinUISlider
TinUI的高级滑动条控件。
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是索引,不是值。
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()
RangeSlider
tinuislider.rangeslider.RangSlider
RangeSlider(
canvas: BasicTinUI,
pos: tuple,
width=200,
fg="#4554dc",
activefg="#4554dc",
bg="#868686",
buttonbg="#ffffff",
buttonoutline="#cccccc",
data=(1, 2, 3, 4, 5),
start_left=None,
start_right=None,
direction="x",
anchor="nw",
command=None,
)
- start_left::小段索引
- start_right::大端索引
disable(sign='#C8C8C8')
禁用。
active_state()
激活控件。
get()
获取当前大小两端选值。
set(left=None, right=None)
设置大小两端选值,需要在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)
def on_change(val):
print("Range:", val)
root = Tk()
root.geometry("400x200")
ui = BasicTinUI(root)
ui.pack(fill="both", expand=True)
slider = RangeSlider(
canvas=ui,
pos=(100, 100),
width=250,
data=list(range(0, 101, 10)),
start_left=2,
start_right=7,
anchor="center",
direction='y',
command=on_change,
)
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)
root.mainloop()
Metadata
Release files for tinuislider 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tinuislider-1.2.0.tar.gz | 12.4 kB | Without provenance | Details for tinuislider-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tinuislider-1.2.0-py3-none-any.whl | Python 3 | none | any | Details for tinuislider-1.2.0-py3-none-any.whl |
Total release size: 26.1 kB
Release files / tinuislider-1.2.0.tar.gz
| Download URL | tinuislider-1.2.0.tar.gz |
|---|---|
| Size | 12.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d5a419d185f6d6cf95b32ef2a9088329139daa022c306052f25acdb6b9a31892
|
|
BLAKE2b-256 checksum How to use checksums |
fad1c0503914d5fec345db7764898d4eacb8a10b99e1762c15a99e0be93ffc8a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Release files / tinuislider-1.2.0-py3-none-any.whl
| Download URL | tinuislider-1.2.0-py3-none-any.whl |
|---|---|
| Size | 13.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f8b0fa3b722176ee8b8f399bc2a3706c69455c0b4794dca01206b665708df660
|
|
BLAKE2b-256 checksum How to use checksums |
5db878112bbbb63a3c5864aff14e53cc398da74e4ca2fac48ea1675531335be7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Security for tinuislider 1.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.