Tkinter: Strange behavior using place() and changing cursors

Mudcat mnations at gmail.com
Tue Nov 14 11:45:52 EST 2006


Wojciech Mula wrote:
> Mudcat wrote:
> > [...]
>
> You have to set cursor once, Tk change it automatically:
>
> > 	def buildFrame(self):
> > 		self.f = Frame(self.master, height=32, width=32, relief=RIDGE,
> > borderwidth=2)
> > 		self.f.place(relx=.5,rely=.5)
>  		#self.f.bind( '<Enter>', self.enterFrame )
>  		#self.f.bind( '<Leave>', self.leaveFrame )
>  		self.f.configure(cursor = 'sb_h_double_arrow')


The problem is I need the ability to change it dynamically. I don't
want the cursor to be the double_arrow the whole time the mouse hovers
inside that frame. It's supposed to be a resize arrow when the mouse is
on the frame border, and regular cursor once it passes to the inner
part of the frame.

Unless there is a better way to do this, I have written code to
determine if the mouse is on the edge or not. There doesn't seem to be
a 'mouseover' type event to determine if the mouse is currently on the
frame border itself. As a result, I calculate the position of the mouse
and set the cursor appropriately.

I have also determined that this is not a problem if the button is not
packed inside the frame.  So somehow the interaction of the internal
button is causing this problem.




More information about the Python-list mailing list