Tk horizontal scrollbar infinite loop

C

Chris

Hi,

I'm having a bizarre problem with Ruby/Tk. I'm running OS X 10.4 with
the standard ruby:

ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0]

The code below is the simplest code that reproduces the problem.
Namely, when run, I see my window and scrollbar flicker rapidly,
apparently between two different sizes.

----
require 'tk'

top = TkRoot.new
f = TkFrame.new(top)
sb = TkScrollbar.new(f,'orient'=>'horizontal')
sb.pack('side'=>'bottom')
f.pack
Tk.mainloop
--

All of this is required. It works fine:
* without the intermediate frame, f
* without orient=>horizontal
* without side=>bottom

Any help would be much appreciated. Please e-mail any replies to me at
(e-mail address removed) as I do not read this group regularly.

Thank you,
Chris
 
H

Hidetoshi NAGAI

From: "Chris" <[email protected]>
Subject: Tk horizontal scrollbar infinite loop
Date: Fri, 24 Feb 2006 14:38:32 +0900
Message-ID: said:
The code below is the simplest code that reproduces the problem.
Namely, when run, I see my window and scrollbar flicker rapidly,
apparently between two different sizes.

Hmmm.... It may be the trouble on your Tcl/Tk.
At least, I couldn't reproduce your problem on my linux box.
Could you report me the result of the following Tcl/Tk script?
 
H

Hidetoshi NAGAI

From: Chris Alfeld <[email protected]>
Subject: Re: Tk horizontal scrollbar infinite loop
Date: Sat, 25 Feb 2006 01:06:27 +0900
Message-ID: said:
I have also tried it on 1.8.4 and it appears there as well.
ruby 1.8.4 (2005-12-24) [powerpc-darwin8.5.0]

Do you mean that 1.8.4 has no problem? Or still has the problem?
# I'm very sorry that I'm poor at English.

If 1.8.4 doesn't have the problem, the bug may depend on
the following change.
-------------------------------------------------------
Wed Nov 2 19:03:06 2005 Hidetoshi NAGAI <[email protected]>

* ext/tcltklib/tcltklib.c (ip_rbUpdateObjCmd,
ip_rb_threadUpdateObjCmd): passed improper flags to
DoOneEvent().
-------------------------------------------------------

Anyway, if :pady=>1 fixes the problem, the bug may depend on
'update' step.
Could you try the followings?
-----<test 1>------------------------------------------
require 'tk'

f = TkFrame.new
sb = TkScrollbar.new(f, :eek:rient=>:horizontal)
sb.pack:)side=>:bottom, :fill=>:x)
Tk.update_idletasks # <--- add this
f.pack:)side=>:bottom, :fill=>:x)

Tk.mainloop
-------------------------------------------------------
-----<test 2>------------------------------------------
require 'tk'

evloop = Thread.new{Tk.mainloop}

f = TkFrame.new
sb = TkScrollbar.new(f, :eek:rient=>:horizontal)
sb.pack:)side=>:bottom, :fill=>:x)
f.pack:)side=>:bottom, :fill=>:x)

evloop.join
 
H

Hidetoshi NAGAI

From: Chris Alfeld <[email protected]>
Subject: Re: Tk horizontal scrollbar infinite loop
Date: Sun, 26 Feb 2006 00:48:22 +0900
Message-ID: said:
1.8.4 still has the problem.
Both of the tests below have the problem.

Hmmm... That is a bad news.
Well, what message do you get from the following on 1.8.4?
---------------------------------------------------
require 'tk'

r = Tk.root
f = TkFrame.new
sb = TkScrollbar.new(f, :eek:rient=>:horizontal)

p ['a',
[[r.winfo_reqwidth,r.winfo_reqheight],
[r.winfo_width,r.winfo_height]],
[[f.winfo_reqwidth,f.winfo_reqheight],
[f.winfo_width,f.winfo_height]],
[[sb.winfo_reqwidth,sb.winfo_reqheight],
[sb.winfo_width,sb.winfo_height]]
]

sb.pack:)side=>:bottom, :fill=>:x)

p ['b',
[[r.winfo_reqwidth,r.winfo_reqheight],
[r.winfo_width,r.winfo_height]],
[[f.winfo_reqwidth,f.winfo_reqheight],
[f.winfo_width,f.winfo_height]],
[[sb.winfo_reqwidth,sb.winfo_reqheight],
[sb.winfo_width,sb.winfo_height]]
]

Tk.update

p ['c',
[[r.winfo_reqwidth,r.winfo_reqheight],
[r.winfo_width,r.winfo_height]],
[[f.winfo_reqwidth,f.winfo_reqheight],
[f.winfo_width,f.winfo_height]],
[[sb.winfo_reqwidth,sb.winfo_reqheight],
[sb.winfo_width,sb.winfo_height]]
]

f.pack:)side=>:bottom, :fill=>:x)

p ['d',
[[r.winfo_reqwidth,r.winfo_reqheight],
[r.winfo_width,r.winfo_height]],
[[f.winfo_reqwidth,f.winfo_reqheight],
[f.winfo_width,f.winfo_height]],
[[sb.winfo_reqwidth,sb.winfo_reqheight],
[sb.winfo_width,sb.winfo_height]]
]

Tk.update

p ['e',
[[r.winfo_reqwidth,r.winfo_reqheight],
[r.winfo_width,r.winfo_height]],
[[f.winfo_reqwidth,f.winfo_reqheight],
[f.winfo_width,f.winfo_height]],
[[sb.winfo_reqwidth,sb.winfo_reqheight],
[sb.winfo_width,sb.winfo_height]]
]

Tk.after(1000){
p ['f',
[[r.winfo_reqwidth,r.winfo_reqheight],
[r.winfo_width,r.winfo_height]],
[[f.winfo_reqwidth,f.winfo_reqheight],
[f.winfo_width,f.winfo_height]],
[[sb.winfo_reqwidth,sb.winfo_reqheight],
[sb.winfo_width,sb.winfo_height]]
]
}

Tk.mainloop
---------------------------------------------------

My Linux box returns
------------------------------------------------------------------------
["a", [[200, 200], [1, 1]], [[1, 1], [1, 1]], [[2, 21], [1, 1]]]
["b", [[200, 200], [1, 1]], [[1, 1], [1, 1]], [[2, 21], [1, 1]]]
["c", [[200, 200], [200, 200]], [[2, 21], [1, 1]], [[2, 21], [1, 1]]]
["d", [[200, 200], [200, 200]], [[2, 21], [1, 1]], [[2, 21], [1, 1]]]
["e", [[42, 21], [42, 21]], [[42, 21], [42, 21]], [[42, 21], [42, 21]]]
["f", [[42, 21], [42, 21]], [[42, 21], [42, 21]], [[42, 21], [42, 21]]]
------------------------------------------------------------------------

When sb.pack:)side=>:bottom, :fill=>:x, :pady=>1), returns
------------------------------------------------------------------------
["a", [[200, 200], [1, 1]], [[1, 1], [1, 1]], [[2, 21], [1, 1]]]
["b", [[200, 200], [1, 1]], [[1, 1], [1, 1]], [[2, 21], [1, 1]]]
["c", [[200, 200], [200, 200]], [[2, 23], [1, 1]], [[2, 21], [1, 1]]]
["d", [[200, 200], [200, 200]], [[2, 23], [1, 1]], [[2, 21], [1, 1]]]
["e", [[42, 23], [42, 23]], [[42, 23], [42, 23]], [[42, 21], [42, 21]]]
["f", [[42, 23], [42, 23]], [[42, 23], [42, 23]], [[42, 21], [42, 21]]]
 
H

Hidetoshi NAGAI

From: Chris Alfeld <[email protected]>
Subject: Re: Tk horizontal scrollbar infinite loop
Date: Sun, 26 Feb 2006 06:23:49 +0900
Message-ID: said:
I can generate the problem in wish as well. The previous test on wish did
not use the -fill or -side arguments to pack, when I add them the same
problem occurs.

I conclude that this is a Tcl/Tk Framework bug, not a Ruby/Tk bug.

That is an unfortunate situation for you.
However, That is a good news for Ruby/Tk. ;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,202
Messages
2,571,057
Members
47,665
Latest member
salkete

Latest Threads

Top