画布的宽度是否有限制 [英] Is there a limit for the width of a canvas
问题描述
画布属性width的值是否有限制?
在下面的示例中,我在ScrolledWindow中创建一个Canvas。 p>
#包
package require BWidget
#Mainframe
set mfr [MainFrame。 mfr -textvariableTest]
pack $ mfr -fill both -expand yes
#创建一个带有两个窗格的窗口
set pw1 [PanedWindow [$ mfr getframe]。 pw1-left]
set pat [$ pw1 add -minsize 200]
set pai [$ pw1 add -minsize 200]
pack $ pw1 -fill both -expand yes -anchor nw
#为每个窗格创建一个框架
set tft [TitleFrame $ pat.tft -textScrollable Canvas]
set tfi [TitleFrame $ pai.tfi -textInformations ]
pack $ tft -fill both -expand yes -anchor nw
pack $ tfi -fill both -expand yes -anchor nw
#在ScrolledWindow内创建一个画布
set swt [scrollableFrame b $ b $ swt setwidget $ sft
set tab [canvas [$ sft getframe] .tab -width 50000 -height 200 -background black]
#在画布上绘制一条水平线
$ 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
#为第二个窗格创建一个ScrolledWindow
set swl [ScrolledWindow [$ tfi getframe] .swl -relief sunken -borderwidth 2 -scrollbar vertical -auto both]
pack $ swl -expand yes -fill both
#显示窗口管理器
wm minsize。 600 350
wm deiconify。
wm协议。 WM_DELETE_WINDOW {exit}
bind。 < Control-q> {out}
在本例中,我为画布使用了50 000当我使用滚动条时,画布的黑盒子结束。同样的问题也会影响在画布上绘制的水平线。
我错过了什么吗?
画布的width属性是否有已知的限制?
感谢您的帮助
double
s来存储坐标,所以没有理由为什么你不能远离那些东西。 这是所有的X11的遗产,它使用16位的值在很多关键结构中的坐标和尺寸。改变这在逻辑上很容易,在实践中的很多工作(假设是在所有地方)。
Is there a limit for the value of the attribute "width" of a canvas ?
In the following example, I create 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 before. The same issue also affects the horizontal line which is drawn on the canvas.
Do I missed something ? Is there a known limit for the "width" attribute of the canvas ?
Thanks for your help
Things get a bit funky if you make them larger than 32,000 (strictly 32767, the limit of a signed C short
) particularly at the rendering layer (and definitely don't make the canvas viewport that size!). However, the underlying canvas model uses IEEE double
s to store the coordinates, so there's no reason why you couldn't have things go off that far. You just must keep the size of individual objects down.
This is all a legacy of X11, which uses 16-bit values for coordinates and dimensions in quite a few key structures. Changing this is both logically easy and a lot of work in practice (the assumptions are all over the place).
这篇关于画布的宽度是否有限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!