画布的属性“width”是否有限制?
在以下示例中,我在一个滚动窗口中创建了一个画布。
# 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}
在这个示例中,我使用了“50 000”作为画布的宽度,但当我使用滚动条时,画布的黑色框在之前就结束了。同样的问题也影响了在画布上绘制的水平线。
我错过了什么吗?canvas的“width”属性有已知的限制吗?
谢谢您的帮助。