Tkinter: Strange behavior using place() and changing cursors

Wojciech Muła wojciech_mula at poczta.null.onet.pl.invalid
Tue Nov 14 14:53:42 EST 2006


Mudcat wrote:
> 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.

Problem is really strange, and seems to be a Tk issue, not Tkinter.
I've observed that if method configure is called and **any** parameter
of frame is changed, then frame "forgets" all its children, gets natural
size and then pack children again!  This just(?) causes flickering, and
do not depend on geometry manager --- all place, pack and grid work in
this way.  But only place causes the problem --- I guess it do not block
events, or generate some events.

Workaround:

class Widget:
	def __init__(self, master):
		self.master = master
		self.buildFrame()
		self.buildWidget()
		self.x = 0
		self.y = 0

	# [snip]

	def enterFrame(self, event):
		if self.x != event.x or self.y != event.y:
			self.f.configure(cursor = 'sb_h_double_arrow')
			self.x, self.y = event.x, event.y

	def leaveFrame(self, event):
		if self.x != event.x or self.y != event.y:
			self.f.configure(cursor = '')
			self.x, self.y = event.x, event.y

w.



More information about the Python-list mailing list