-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
Not possible to write into CTkEntry after CTkMessagebox is closed #60
Comments
@SandraHeinzova Can you please provide an example? How are you using the warning messagebox? |
@Akascape Hi, thanks for reply. def validate_date(date):
min_date_possible = datetime(1958, 8, 4)
max_date_possible = datetime.now()
try:
entered_date = datetime.strptime(date, "%Y-%m-%d")
if min_date_possible <= entered_date <= max_date_possible:
return True
else:
raise ValueError
except ValueError:
CTkMessagebox(title="Warning", message="Wrong date. The date has to be in format of YYYY-MM-DD. OR between 1958-08-04 and present.", icon="warning")
return False and date comes from this Entry date_entry = ct.CTkEntry(app, placeholder_text="YYYY-MM-DD", justify="center", width=200, height=50)
date_entry.pack() |
Did you try the |
@Akascape Yes, I am using |
@SandraHeinzova I mean there is also a msg = CTkMessagebox(title="Warning Message!", message="Waning!",
icon="warning")
response = msg.get() |
@Akascape I tried to add response = msg.get()
if response == "Close":
msg.destroy() but there is no change.. the Messagebox open correctly, but when I press the button Close, I cannot use any of CTkEntry's I have.. I have to wait for some long time, or open secondary TopLevel window and close it afterwards to be able enter values into CTkEntry 🤔 |
@SandraHeinzova Ok I will check this soon. For now you can use the normal tkinter messagebox. I will try to provide a fix in next update. |
@Akascape thank you for your help |
@SandraHeinzova Can you please test this example and tell if this issue is happening with this example: import customtkinter
from CTkMessagebox import CTkMessagebox
root = customtkinter.CTk()
CTkMessagebox()
entry = customtkinter.CTkEntry(master=root)
entry.pack(padx=10, pady=10)
root.mainloop() |
@Akascape yes, the issue is still happening. CTkMessagebox(app_ct, message="Wrong date")
app_ct.after(10000, date_entry.focus_force) but is hard to estimate amount of milliseconds 🤔 also |
@SandraHeinzova Ok, I am not facing this issue with the messagebox and entries, so I don't know why it is showing this behaviour in your system. But it's good that we can solve it with the force_focus method. |
@Akascape I am glad it's not some common issue, it's really weird it's not working properly on my system. But thank you for your effort |
I have also run into the same issue. I tried your sample app above and it "appeared" to work, but then I went and clicked on the main window while the messagebox was still open (just to test modality), and from that point on, dismissing the messagebox did not allow access to your Entry box. In my app, checkboxes and buttons on my main window continued to operate after the messagebox was dismissed. I did find the force_focus() workaround effective, although it seems I only need a 1,000ms delay, not 10,000. Tested on: |
Yes I have also faced this issue under macOS 14.2.1 with python 3.12. I now use the workaround with |
I also have the same issue, if someone finds a solution please post it 🙏 . |
I've found a solution. I will send it later this day, if I found the snippet. |
After some searching. I've found the workaround again. CTkMessagebox.CTkMessagebox(title="Invalid input", message="Please enter a valid number for epochs.", option_1="OK", icon="warning")
self.after(100, self.epochs_entry.focus_force)
return You need to set the focus, and then it should work. |
Hello.
I'm using CTkMessagebox to show that user entered wrong format of date. Everything works fine until I close the CTkMessagebox with warning (by button and also the X on left top corner). After that, I have to wait several seconds (almost minutes) to be able to enter date again - and it's not very user friendly .
Is there anything I overlooked?
Thank you for any ideas!
Sandra
The text was updated successfully, but these errors were encountered: