画布的属性“宽度”的值是否有限制?画布的宽度是否有限制
在以下示例中,我在ScrolledWindow中创建了一个Canvas。
# 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”的宽度为画布上,但是当我使用滚动条画布的黑箱之前结束。同样的问题也会影响画布上绘制的水平线。
我错过了什么吗? 画布的“width”属性是否有已知限制?
感谢您的帮助
是的,我最近没有看最近的浏览器画布尺寸最大值,但他们曾经是8k-12k宽度或高度,最大值为2mb最大。恕我直言,过多的帆布尺寸通常是为了“扁平化”设计要求而创建的。如果由于画布大小而遇到问题(例如,您已超出浏览器的最大大小),那么您应该将其作为信号将您的设计更改为不太平。 – markE 2014-10-26 21:42:24
渲染所需的缓冲区大小完全取决于视口的大小(画布的可见部分)。但是,当使用coords从视口中可见的“short”范围(_after_平移到视口坐标)绘制事物时,坐标计算会有点不可思议。 – 2014-10-27 10:08:36