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

Unable to use scrollbar when attaching to option menu if using CTkScrollableDropdownFrame [FIX (maybe)] #50

Open
hardlyprogramming opened this issue Aug 21, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@hardlyprogramming
Copy link

I was unable to use the scrollbar (or even bind mousewheel) to the dropdown menu as any type of button event caused the menu to withdraw. It should be noted that I only experienced this issue when using CTkScrollableDropdownFrame.

I found a fix. Though I'm not sure if it could potentially affect something else. In any case this is what worked for me:

FIX:

comment out line 27 in ctk_scrollable_dropdown_frame.py:

# self.attach.winfo_toplevel().bind("<ButtonPress>", lambda e: self._withdraw() if not self.disable else None, add="+") 

If interested, I was having a hard time binding the mouse-wheel to the dropdown menu. Adding these lines to CTkScrollableDropdownFrame class after "self.frame" is created and configured is what finally worked. However, this could just be a knowledge gap on my part.

        self.frame._scrollbar.grid_configure(padx=3)

        ########################### MODIFIED CODE ######################
        #   This binds the mousewheel to be able to scroll in the optionmenu dropdown  #
        
        # if using linux
        self.frame.bind_all('<Button-4>', lambda e: self.frame._parent_canvas.yview_scroll(-1, 'units'))
        self.frame.bind_all('<Button-5>', lambda e: self.frame._parent_canvas.yview_scroll(1, 'units'))

        # If using windows
        #  self.frame.bind_all('<MouseWheel>'), lambda e: self.frame._parent_canvas.yview_scroll(1, 'units))
@Akascape Akascape added the enhancement New feature or request label Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants