class DateEntry(ttk.Frame)
...
def _configure_set(self, **kwargs):
"""Override configure method to allow for setting custom
DateEntry parameters"""
if "state" in kwargs:
state = kwargs.pop("state")
if state in ["readonly", "invalid"]:
self.entry.configure(state=state)
elif state == "disabled":
self.entry.configure(state=state)
self.button.configure(state=state)
else:
kwargs[state] = state
1条答案
按热度按时间9gm1akwq1#
查看ttkbootstrap
DateEntry
小部件的source code可以发现,它继承自ttk.Frame
类,而ttk.Frame
类本身不接受state
更改,但是,由于DateEntry
覆盖了内置的configure
方法,因此以下状态似乎是允许的:'disabled'
'readonly'
'invalid'
据我所知,默认的“正常”状态是
'readonly'
,但我不确定。