Hello all,
I have an installation of tcl/tk 9.0.1 compiled from source on a mac mini with macOS 13.2, and I found out something quite weird: it seems that "update idletasks" has no effect at all on this platform, when it works as expected on Windows and Linux.
Here is a script showing the problem:
-----------------------------------
ttk::progressbar .pbar -mode determinate -value 0 -length 300
pack .pbar -side top -padx 8 -pady 8
proc compute { x0 } {
set x $x0
while { $x > 1 } {
if { $x % 2 == 0 } {
set x [expr $x / 2]
} else {
set x [expr 3 * $x + 1]
}
}
}
proc run {} {
. configure -cursor watch
update idletasks
for { set i 0 } { $i < 100 } { incr i } {
for { set j 0 } { $j < 500 } { incr j } {
compute [expr $i + 1000]
}
.pbar configure -value $i
update idletasks
}
. configure -cursor ""
}
ttk::button .btn -text "Go!" -command run
pack .btn -side bottom -padx 8 -pady 8
-----------------------------------
If I run this on Windows or Linux, I can see the progress bar being
updated after I click the "Go!" button. If I do the same on macOS, the window is stuck in its initial state, and the display is updated only when everything is finished.
Note that the problem strangely does not happen when the computation is replaced by a "after 100" for example. In this case, the display is
updated. But the script is actually doing something, it doesn't seem to work. Replacing "update idletasks" with just "update" works, but
sometimes, you just don't want to handle pending events.
Can anybody confirm they have the same issue? I'd like to be sure it's not something in my build that causes the problem before creating a ticket.
Thanks!
That's a nice find. I wish I has something constructive to say. Do
make a ticket
Eric Brunel <eric.brunel@pragmadev.com> posted:
Hello all,
I have an installation of tcl/tk 9.0.1 compiled from source on a mac
mini with macOS 13.2, and I found out something quite weird: it seems
that "update idletasks" has no effect at all on this platform, when it
works as expected on Windows and Linux.
Here is a script showing the problem:
-----------------------------------
ttk::progressbar .pbar -mode determinate -value 0 -length 300 pack
.pbar -side top -padx 8 -pady 8
proc compute { x0 } {
set x $x0 while { $x > 1 } {
if { $x % 2 == 0 } {
set x [expr $x / 2]
} else {
set x [expr 3 * $x + 1]
}
}
}
proc run {} {
. configure -cursor watch update idletasks for { set i 0 } { $i < 100
} { incr i } {
for { set j 0 } { $j < 500 } { incr j } {
compute [expr $i + 1000]
}
.pbar configure -value $i update idletasks
}
. configure -cursor ""
}
ttk::button .btn -text "Go!" -command run pack .btn -side bottom -padx
8 -pady 8 -----------------------------------
If I run this on Windows or Linux, I can see the progress bar being
updated after I click the "Go!" button. If I do the same on macOS, the
window is stuck in its initial state, and the display is updated only
when everything is finished.
Note that the problem strangely does not happen when the computation is
replaced by a "after 100" for example. In this case, the display is
updated. But the script is actually doing something, it doesn't seem to
work. Replacing "update idletasks" with just "update" works, but
sometimes, you just don't want to handle pending events.
Can anybody confirm they have the same issue? I'd like to be sure it's
not something in my build that causes the problem before creating a
ticket.
Thanks!
Hi,
according to the doc there's no -configure option for ttk::progressbar
++
On Wed, 05 Mar 2025 15:21:31 GMT, nab wrote:
Eric Brunel <eric.brunel@pragmadev.com> posted:
Hello all,
I have an installation of tcl/tk 9.0.1 compiled from source on a mac
mini with macOS 13.2, and I found out something quite weird: it seems
that "update idletasks" has no effect at all on this platform, when it
works as expected on Windows and Linux.
Here is a script showing the problem:
-----------------------------------
ttk::progressbar .pbar -mode determinate -value 0 -length 300 pack
.pbar -side top -padx 8 -pady 8
proc compute { x0 } {
set x $x0 while { $x > 1 } {
if { $x % 2 == 0 } {
set x [expr $x / 2]
} else {
set x [expr 3 * $x + 1]
}
}
}
proc run {} {
. configure -cursor watch update idletasks for { set i 0 } { $i < 100 >>> } { incr i } {
for { set j 0 } { $j < 500 } { incr j } {
compute [expr $i + 1000]
}
.pbar configure -value $i update idletasks
}
. configure -cursor ""
}
ttk::button .btn -text "Go!" -command run pack .btn -side bottom -padx
8 -pady 8 -----------------------------------
If I run this on Windows or Linux, I can see the progress bar being
updated after I click the "Go!" button. If I do the same on macOS, the
window is stuck in its initial state, and the display is updated only
when everything is finished.
Note that the problem strangely does not happen when the computation is
replaced by a "after 100" for example. In this case, the display is
updated. But the script is actually doing something, it doesn't seem to
work. Replacing "update idletasks" with just "update" works, but
sometimes, you just don't want to handle pending events.
Can anybody confirm they have the same issue? I'd like to be sure it's
not something in my build that causes the problem before creating a
ticket.
Thanks!
Hi,
according to the doc there's no -configure option for ttk::progressbar
++
I'm using the "configure" sub-command on the progress bar to change its value, I'm not using a "-configure" option... And I did test the script several times, on 2 versions of macOS as well as on Windows and Linux, it does work, and shows the problem on macOS.
If you just copy and paste the code from my original post, I'm sure you'll see that it does work.
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 1,028 |
Nodes: | 10 (0 / 10) |
Uptime: | 116:08:57 |
Calls: | 13,328 |
Files: | 186,574 |
D/L today: |
99 files (19,550K bytes) |
Messages: | 3,354,904 |