Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateEntry configure() doesn't change startdate in DateEntry field #499

Open
windir19 opened this issue Oct 13, 2023 · 2 comments
Open

DateEntry configure() doesn't change startdate in DateEntry field #499

windir19 opened this issue Oct 13, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@windir19
Copy link

Desktop (please complete the following information):

ttkbootstrap v1.10.1
OS: Windows

Describe the bug

I am trying to write a script that when a button is click will find a datetime somewhere and update it into the ttkbootstrap DateEntry. tkinter uses set_date() to change what is shown in the field but it seems that doesn't exist for ttkbootstrap version of DateEntry. I asked a question about how to set the DateEntry with tkinter in the github forums for ttkbootstrap and was told by @rdbende that I should use .configure(startdate=datetimevalue)

@rdbende mentioned it looks like a bug because he couldn't get it to. When I run it I don't get an error in the console but it doesn't seem to change the date listed in the field so it doesn't work for me either.

I want to iterate that my goal is NOT to set the "startdate" when I create the button in the GUI but to have it set upon an action like with a button press.

To Reproduce

I wrote this small code to explain what I am trying to do.

import ttkbootstrap as ttk
import datetime

root = ttk.Window()

some_date = datetime.datetime.fromisoformat("2022-11-11")

date_chooser = ttk.DateEntry(root, startdate=datetime.datetime.today())
date_chooser.pack()

set_date_btn = ttk.Button(root, text="Set Date", command=lambda: date_chooser.configure(startdate=some_date))
set_date_btn.pack()

root.mainloop()

Expected behavior

When you click the button "Set Date" button I would expect the value of the DateEntry field to change to whatever datetime I pull from a source (some_date in the code as an example).

Screenshots

No response

Additional context

If there is a different way to set the date value in DateEntry from an action, I would love to know or see it in the documentation for ttkbootstrap. Thank you.

@windir19 windir19 added the bug Something isn't working label Oct 13, 2023
@rdbende
Copy link

rdbende commented Oct 13, 2023

atkinter uses set_date() to change what is shown in the field but it seems that doesn't exist for ttkbootstrap version of DateEntry

Worth noting that what's here referred to as tkinter's date entry is the DateEntry widget from the tkcalendar package.
I'd also like to add, that while using .configure() is the more tkinter-ic way, for compatibility with tkcalendar it would be niceto also add a set_date method.

@Megsman
Copy link

Megsman commented Dec 28, 2023

My work around was to create a new DateEntry with the startdate configured to be the new date that I wanted it to change to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants