Discussion:
? BUG - Tcl9.0b3 Linux - canvas bind
(too old to reply)
abu
2024-08-08 14:24:25 UTC
Permalink
Please, can you run this 4-lines script on Linux with TclTk 9.0b3 ?

Note that it runs as expected with TclTk 9.0b3 on Windows and MacOS, so
I suspect
a) my Linux build is wrong
b) it's a bug only for unix (Linux Ubuntu in my case)

Any suggestion is appreciated.
Here's the script


## ---------------------------------------------------------------------

# Test with TclTk 9.0b3
# Windows: OK
# Linux (Ubuntu): not working (OVAL doesn't change color, no message
is printed)
# MacOS: OK


pack [canvas .c -background yellow]
c create oval {20 20 200 200} -fill red -activefill blue -tag OVAL

c bind OVAL <Enter> { puts "Entering the OVAL"}
c bind OVAL <ButtonPress-1> { puts "Clicked inside the OVAL"}

# Expected behaviour:
# when moving the cursor inside the OVAL
# - it turns from red to blue
# - a message is printed
# when clicking the OVAL
# - a message is printed

# -------------------------------------------------------------
Harald Oehlmann
2024-08-08 15:16:15 UTC
Permalink
Post by abu
Please, can you run this 4-lines script on Linux with TclTk 9.0b3 ?
Note that it runs as expected with TclTk 9.0b3 on Windows and MacOS, so
I suspect
a) my Linux build is wrong
b) it's a bug only for unix (Linux Ubuntu in my case)
Any suggestion is appreciated.
Here's the script
## ---------------------------------------------------------------------
# Test with TclTk 9.0b3
#   Windows: OK
#   Linux (Ubuntu): not working (OVAL doesn't change color, no message
is printed)
#   MacOS: OK
pack [canvas .c -background yellow]
c create oval {20 20 200 200} -fill red  -activefill blue -tag OVAL
c bind OVAL <Enter> { puts "Entering the OVAL"}
c bind OVAL <ButtonPress-1> { puts "Clicked inside the OVAL"}
#    when moving the cursor inside the OVAL
#      - it turns from red to blue
#      - a message is printed
#    when clicking the OVAL
#      - a message is printed
# -------------------------------------------------------------
may it just happen, that stdout is not shown?
Perhaps, you have started using "wish".
Maybe:
- start with tclsh + package require tk
- replace the puts by tk_messageBox

Just an idea...
Harald
Christian Gollwitzer
2024-08-09 15:54:31 UTC
Permalink
Post by Harald Oehlmann
may it just happen, that stdout is not shown?
Perhaps, you have started using "wish".
That's a Windows-only issue. On Linux, there is always stdin/out/err
connected.

Christian

Paul Obermeier
2024-08-08 15:47:54 UTC
Permalink
Post by abu
Please, can you run this 4-lines script on Linux with TclTk 9.0b3 ?
Note that it runs as expected with TclTk 9.0b3 on Windows and MacOS, so
I suspect
a) my Linux build is wrong
b) it's a bug only for unix (Linux Ubuntu in my case)
Any suggestion is appreciated.
Here's the script
## ---------------------------------------------------------------------
# Test with TclTk 9.0b3
#   Windows: OK
#   Linux (Ubuntu): not working (OVAL doesn't change color, no message
is printed)
#   MacOS: OK
pack [canvas .c -background yellow]
c create oval {20 20 200 200} -fill red  -activefill blue -tag OVAL
c bind OVAL <Enter> { puts "Entering the OVAL"}
c bind OVAL <ButtonPress-1> { puts "Clicked inside the OVAL"}
#    when moving the cursor inside the OVAL
#      - it turns from red to blue
#      - a message is printed
#    when clicking the OVAL
#      - a message is printed
# -------------------------------------------------------------
Works for me on Debian 12.6, SUSE 15.6 and Ubuntu 24.04.

Paul
greg
2024-08-08 15:55:44 UTC
Permalink
Post by abu
Please, can you run this 4-lines script on Linux with TclTk 9.0b3 ?
Note that it runs as expected with TclTk 9.0b3 on Windows and MacOS, so
I suspect
a) my Linux build is wrong
b) it's a bug only for unix (Linux Ubuntu in my case)
Any suggestion is appreciated.
Here's the script
## ---------------------------------------------------------------------
# Test with TclTk 9.0b3
#   Windows: OK
#   Linux (Ubuntu): not working (OVAL doesn't change color, no message
is printed)
#   MacOS: OK
pack [canvas .c -background yellow]
c create oval {20 20 200 200} -fill red  -activefill blue -tag OVAL
c bind OVAL <Enter> { puts "Entering the OVAL"}
c bind OVAL <ButtonPress-1> { puts "Clicked inside the OVAL"}
#    when moving the cursor inside the OVAL
#      - it turns from red to blue
#      - a message is printed
#    when clicking the OVAL
#      - a message is printed
# -------------------------------------------------------------
#it works for me

#package require Tk
pack [canvas .c -background yellow]
.c create oval {20 20 200 200} -fill red -activefill blue -tag OVAL

.c bind OVAL <Enter> { puts "Entering the OVAL"}
.c bind OVAL <ButtonPress-1> { puts "Clicked inside the OVAL"}

#parray tcl_platform
#puts [info patchlevel]
#puts [info nameofexecutable]

# Linux Debian Sid
# tcl/tk 9.0b3 from https://gitlab.com/teclabat/tcltk
# change from red to blue ok
# tclsh with
# package require Tk

if {0} {
#output 1:
tcl_platform(byteOrder) = littleEndian
tcl_platform(engine) = Tcl
tcl_platform(machine) = x86_64
tcl_platform(os) = Linux
tcl_platform(osVersion) = 6.10.3-amd64
tcl_platform(pathSeparator) = :
tcl_platform(platform) = unix
tcl_platform(pointerSize) = 8
tcl_platform(user) = greg
tcl_platform(wordSize) = 8
9.0b3
/opt/tcltk90/bin/wish90
Entering the OVAL
Entering the OVAL
Clicked inside the OVAL

#output 2:
tcl_platform(byteOrder) = littleEndian
tcl_platform(engine) = Tcl
tcl_platform(machine) = x86_64
tcl_platform(os) = Linux
tcl_platform(osVersion) = 6.10.3-amd64
tcl_platform(pathSeparator) = :
tcl_platform(platform) = unix
tcl_platform(pointerSize) = 8
tcl_platform(user) = greg
tcl_platform(wordSize) = 8
9.0b3
/opt/tcltk90/bin/tclsh
Entering the OVAL
Entering the OVAL
Clicked inside the OVAL
}

Gregor
abu
2024-08-08 22:09:04 UTC
Permalink
Many thanks to everybody.
I downloaded tcl/tk 9.0b3 from https://gitlab.com/teclabat/tcltk.

Still the same problems ...

but the root cause was .. my Linux Virtual Machine !

I then installed WSL
(https://canonical-ubuntu-wsl.readthedocs-hosted.com/en/latest/guides/install-ubuntu-wsl2/),
WOW , far better than a Virtual Machine !

I was able to run all my Tcl9 tests !

Next days I will publish a few porting of my C-extensions for Tcl9
lets's start with extrafont, perlin-noise ...

Thank you again for your help.
Loading...