Skip to main content

TinUIPicker

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


TinUIDatePicker

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, show_sec=True,
    now = datetime.now(),
    command=None, anchor='nw', **kwargs
)

默认样式同TinUIDatePicker

  • is_24h-是否是24小时制,如果,则开头显示AMPM选项
  • show_sec-是否可选

command接收一个形如16:00:09或者PM 04:00:09的字符串参数。若show_secFalse,则不回传

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

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


TinUICalendarPicker

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

默认样式同TinUIDatePicker。本控件提供日历样式的日期选择功能。

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

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

设置年-月-日。


样式表

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


面板布局

通过TinUIDatePicker.uid获取TinUIDatePicker的控件标识符。时间选择器与日历选择器类似。

面板布局行为与picker一致。


使用示例

from datetime import datetime
from tkinter import Tk

from tinui import BasicTinUI, ExpandPanel, HorizonPanel
from tinuipicker.datepicker import TinUIDatePicker
from tinuipicker.timepicker import TinUITimePicker
from tinuipicker import pickerlight, pickerdark

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

ui = BasicTinUI(root)
ui.pack(fill='both', expand=True)

tdp = TinUIDatePicker(ui, (10,10), font=("Segoe UI", 12), now=datetime(2026, 2, 19), command=print, anchor='center', **pickerlight)
tdp.set_date(2016, 10)

ttp = TinUITimePicker(ui, (10,10), font=("Segoe UI", 12), is_24h=False, show_sec=False, now=datetime(1,1,1,6,23,45), command=print, anchor='center', **pickerdark)
ttp.set_time(16,0,19)

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

ep = ExpandPanel(ui, bg='#f3f3f3')
hp.add_child(ep, weight=1)
ep.set_child(tdp.uid)

ep2 = ExpandPanel(ui, bg='#202020')
hp.add_child(ep2, weight=1)
ep2.set_child(ttp.uid)

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

root.mainloop()

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.7.1.tar.gz (16.1 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.7.1-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for tinuipicker-1.7.1.tar.gz
Algorithm Hash digest
SHA256 ea9ea11191f05acad09ba47b825cdef0f1a7150f84effc259b4cd0ab199e2b8e
MD5 f0e5ba18d8c6dc6f4636a28dabd2a6d8
BLAKE2b-256 0e2bd175ff2eeff2ef958938a2a8cb2bb490a06ff2954e3a84133e8a48a77674

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for tinuipicker-1.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8656d0ba66fb244b4f797f916a0c09bb2a4d5b8bcc4bf6e5f6519b3c6f0ac059
MD5 636c88e591bcf59f9299518da76e873c
BLAKE2b-256 b87e9777559770b4a941c4dae58a31254bf1808f9c907fa2a5a1e564a6f037b1

See more details on using hashes here.

Release history Release notifications | RSS feed

1.9.0

2 files

1.8.0

2 files

This release

1.7.1 This release

2 files

1.7.0

2 files

1.6.0

2 files

1.5.0

2 files

1.4.0

2 files

1.3.0

2 files

1.2.2

2 files

1.2.1

2 files

1.2.0

2 files

1.1.0

2 files

1.0.0

2 files

Supported by

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