Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8272299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:05:17+00:00 2026-06-08T07:05:17+00:00

I am having problems with the way that the right button gets its selection.

  • 0

I am having problems with the way that the right button gets its selection. I am not good with coordinates so i dont know how to reverse the way i am selecting. I would like to scroll the listbox selection the way the mouse is going, not the reverse like it is right now. I would simply like it to select the next item in the listbox when moving the mouse down/up.

from Tkinter import *

def _select(y):
    row = lb.nearest(y)
    lb.selection_clear(0, END)
    lb.selection_set(row)

def _b2motion(x, y):
    lb.scan_dragto(x, y)
    _select(y)
    return 'break'


root = Tk()

sb = Scrollbar(root)
lb =Listbox(root, width=20,yscrollcommand=sb.set)

lb.bind('<B3-Motion>', lambda e: _b2motion(e.x, e.y))
sb.config(command=lb.yview)

lb.grid(row=0,column=0)
sb.grid(row=0,column=1,sticky=N+S)


for x in range(50):
    lb.insert(END, x)

mainloop()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T07:05:18+00:00Added an answer on June 8, 2026 at 7:05 am

    If you flip the sign on the y in the motion box that will change the direction of scrolling. Divide by an integer if you need it slower, I liked 3.

    def _b2motion(x, y):
        lb.scan_dragto(x, (-y/3)) #here
        _select(y)
        return 'break'
    

    I am not sure what the rest of your problem is… are you trying to replicate what the left button does with the right button?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have started having problems with my VPS in the way that it would
I'm having problems with finding a way to call the right form of a
Is anyone else having problems with InfoBox ? Is there a better way to
im having problems starting a codeigniter project, the problem is that when i do
I'm having problems getting a list formatted the way I want in Opera. I
I'm struggling a bit with the right architecture for my app. Particularly having problems
I'm writing a card game. Right now I'm having problems with mouse handling. Below
Having problems with a small awk script, Im trying to choose the newest of
Having problems iterating. Problem has to do with const correctness, I think. I assume
Having problems with the combining of two statements in a controller. Both statements work

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.