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

Duplicate tooltip appearance on the same input #29

Open
muhammedjafer opened this issue Aug 23, 2024 · 1 comment
Open

Duplicate tooltip appearance on the same input #29

muhammedjafer opened this issue Aug 23, 2024 · 1 comment

Comments

@muhammedjafer
Copy link

Screenshot 2024-08-23 102458

    def open_directory_dialog(self):
        self.file_path = filedialog.askdirectory(title="Select directory")
        
        if self.file_path != "":
            self.error_label.configure(text="")
            # Display shortened path with tooltip on hover
            self.set_directory_label()
        else:
            self.button.configure(text="Browse directory")
            self.error_label.configure(text="Directory is required")
            
            self.tooltip.hide() if self.tooltip else None

            
    def set_directory_label(self):
        if len(self.file_path) > 15:
            shortened_path = self.file_path[:15] + "..."
            self.button.configure(text=shortened_path)
        else:
            self.button.configure(text=self.file_path)
            
        self.tooltip = CTkToolTip(self.button, message=self.file_path, border_width=1, border_color=settings.get_arya_color())
@muhammedjafer
Copy link
Author

i did a trick to fix it by using destroy method on the tooltip

 self.tooltip.destroy()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant