Skip to main content

tinui扩展数据滚动选择器

Project description

TinUIPicker

TinUI提供滚动选择器功能控件,相比于原版picker,TinUIPicker套件加入了日期选择和时间选择的功能。


TinUIDatePicker

[!important]

TinUIDatePicker原始框架代码由Gemini3根据TinUI的picker源码修改而来,之后我才进行了交互优化和样式优化,AI代码部分未完全审查。

TinUIDatePicker(
    tinui, pos, font=("微软雅黑", 10), command=None, 
    year_range=(2000, 2030), now=datetime.today(), **kwargs
)

# 默认样式表
self.cfg = {
    "fg": kwargs.get("fg", "#1b1b1b"),
    "bg": kwargs.get("bg", "#fbfbfb"),
    "outline": kwargs.get("outline", "#ececec"),
    "activefg": kwargs.get("activefg", "#1b1b1b"),
    "activebg": kwargs.get("activebg", "#f6f6f6"),
    "onbg": kwargs.get("onbg", "#3748d9"),
    "onfg": kwargs.get("onfg", "#eaecfb"),
    "buttonfg": kwargs.get("buttonfg", "#1a1a1a"),
    "buttonbg": kwargs.get("buttonbg", "#f9f9f9"),
    "buttonactivefg": kwargs.get("buttonactivefg", "#1a1a1a"),
    "buttonactivebg": kwargs.get("buttonactivebg", "#f3f3f3"),
    "buttononfg": kwargs.get("buttononfg", "#5d5d5d"),
    "buttononbg": kwargs.get("buttononbg", "#f5f5f5"),
}

command接收一个形如2026-01-30的字符串参数。

set_date(year:int=None, month:int=None, day:int=None)

设置年-月-日,若为None则不变。


TinUITimePicker

TinUITimePicker(
    tinui, pos, font=("微软雅黑", 10), is_24h=True, now = datetime.now(),
    command=None, anchor='nw', **kwargs
)

默认样式同TinUIDatePicker

command接收一个形如16:00:09或者PM 04:00:09的字符串参数。

set_time(hour:int=None, minute:int=None, second:int=None)

设置时-分-秒,若为None则不变。


样式表

TinUIPicker提供了pickerlightpickerdark两种配色样式表,均来自于TinUI明暗配色。


面板布局

通过TinUIDatePicker.uid获取TinUIDatePicker的控件标识符。

面板布局行为与picker一致。


使用示例

from tkinter import Tk
from tinui import ExpandPanel, VerticalPanel, HorizonPanel, BasicTinUI

from tinuipicker.datepicker import TinUIDatePicker
from tinuipicker import pickerlight

root = Tk()
root.geometry('400x400')

ui = BasicTinUI(root)
ui.pack(fill='both', expand=True)
tdp = TinUIDatePicker(ui, (10,10), command=print, anchor='center', **pickerlight)

rp = ExpandPanel(ui)
hp = HorizonPanel(ui)
rp.set_child(hp)

ep = ExpandPanel(ui)
hp.add_child(ep, weight=1)
ep.set_child(tdp.uid)

def update(e):
    rp.update_layout(5,5,e.width-5,e.height-5)
ui.bind('<Configure>',update)

root.mainloop()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tinuipicker-1.1.0.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tinuipicker-1.1.0-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

Details for the file tinuipicker-1.1.0.tar.gz.

File metadata

  • Download URL: tinuipicker-1.1.0.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for tinuipicker-1.1.0.tar.gz
Algorithm Hash digest
SHA256 62614ead25b92749382f3f51bc7bdbf181b53e8136e00cbc2b0614fadfc6eed3
MD5 35f47ca1c2c71478333bf4f8b6f1bcda
BLAKE2b-256 d43f8b48c8b36c516dbffa31ebba2885736ab3a2aa3442b39e29e0b987b71963

See more details on using hashes here.

File details

Details for the file tinuipicker-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: tinuipicker-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for tinuipicker-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 47a4ed1e6416dd9c947eec7765d85aa6cc1f80f370441354548d3d259dc36ac7
MD5 8194aa0bd739a117e68fbcdfaaf6b822
BLAKE2b-256 d9565a053a4c9257458d11f785d7e6cbe1e231e5740e1719b3c11185f86705f6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page