Is there a canvas width limitation

Is there a limit to the value of the "width" attribute of the canvas?

In the following example, I am creating a Canvas in a ScrolledWindow.

# Packages
package require BWidget

# Mainframe
set mfr [MainFrame .mfr -textvariable "Test"]
pack $mfr -fill both -expand yes

# Create a Paned Window with two panes
set pw1 [PanedWindow [$mfr getframe].pw1 -side left]
set pat [$pw1 add -minsize 200]
set pai [$pw1 add -minsize 200]
pack $pw1 -fill both -expand yes -anchor nw

# Create a frame for each pane
set tft [TitleFrame $pat.tft -text "Scrollable Canvas"]
set tfi [TitleFrame $pai.tfi -text "Informations"]
pack $tft -fill both -expand yes -anchor nw
pack $tfi -fill both -expand yes -anchor nw

# Create a canvas inside a ScrolledWindow for the first pane
set swt [ScrolledWindow [$tft getframe].swt -relief sunken -borderwidth 2 -scrollbar horizontal -auto none]
set sft [ScrollableFrame $swt.sft -width 50000 -height 200]
$swt setwidget $sft
set tab [canvas [$sft getframe].tab -width 50000 -height 200 -background black]
# Draw an horizontal line on the canvas
$tab create line 0 100 50000 100 -width 1 -fill white

pack $tab -fill both -expand yes -anchor nw
pack $swt -fill both -expand yes -anchor nw

# Create a ScrolledWindow for the second pane
set swl [ScrolledWindow [$tfi getframe].swl -relief sunken -borderwidth 2 -scrollbar vertical -auto both]
pack $swl -expand yes -fill both

# Display the window manager
wm minsize . 600 350
wm deiconify .
wm protocol . WM_DELETE_WINDOW {exit}
bind . <Control-q> {exit}

      

In this example, I used a width of "50,000" for the canvas, but when I use the scrollbar, the black box of the canvas ends earlier. This same issue also affects the horizontal line that is drawn on the canvas.

Did I miss something? Is there a known limitation for the width attribute for a canvas?

thanks for the help

+3


source to share


1 answer


Things get a little funny if you make them over 32,000 (strictly 32767, signed C limit short

), especially at the rendering level (and definitely don't make the viewport size that size!). However, the underlying canvas model uses IEEE double

to store coordinates, so there is no reason you couldn't go that far. You just have to keep the size of the individual objects.



This is all the legacy of X11, which uses 16-bit values ​​for coordinates and dimensions in a variety of key structures. Changing this is logically easy and works a lot in practice (assumptions are everywhere).

+2


source







All Articles