I want to be able to use scales to let the user answer various questions on screen. However, though I can get scales to work fine in other programs, in this one in particular they seem to have bugged out.

What's happening is that, if I set showvalue = False , I (sometimes) can't move the slider at all. If it's True , it will move, but the program acts like the mouse pointer (or the slider) is somewhere else -- it's almost like I'm using the bottom of the pointer to move it, but not quite.

I have absolutely no idea what could be causing these problems. I've gone through my code in search of something, but I don't even know where to begin to look. I made a separate test program that just produces a scale, to make sure it's not that I have a Mac... but that works perfectly. I put the same program as a function within my other program, and it messes up. I haven't done anything in the program to change mouse settings that I know of. (I'd post the program here, but it's enormous.)

Any help whatsoever would be greatly appreciated.

11 Years
Discussion Span
Last Post by bumsfeld

Okay, just wanted to let people know... through good old-fashioned commenting out sections, I finally pinpointed the problem. It was in the geometry manager. I had this (where sw and sh are the screen width and height respectively):

root.geometry("%dx%d+0+0" % (sw, sh))

and I changed it to this:

root.geometry("%dx%d+1+1" % (sw, sh))

And for some reason that fixed it. I don't know anything about the geometry manager, but there you go.


Must be something peculiar to the Mac OS, this code works fine on Windows:

import Tkinter as tk

def change(event):

root = tk.Tk()

# width x height + x_offset + y_offset (no spaces!)
root.geometry("%dx%d+%d+%d" % (150, 120, 0, 0))

v_red = tk.IntVar()
red = tk.Scale(root, label="Red", variable=v_red, from_=0, to=255)
red.bind('<B1-Motion>', change)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.