Reputation: 223
Linux Debian Jessie
I have created a photo image in TclTk. Once created I want to query the the actual width so I can use it. Where I use the constant 500 in the MWE it is less obvious in the actual program.
% puts $tcl_version
8.6
% package require Tk
8.6.2
% set i [image create photo p0 -width 500]
p0
% #not correct
% image width p0
0
% #correct
% p0 cget -width
500
From the image manual page:
image width name
Returns a decimal string giving the width of image name in pixels.
So I would expect
image width p0
to also return the decimal value for the width. The cget
command does return what I expect.
What am I doing wrong?
Upvotes: 1
Views: 133
Reputation: 5723
Try:
set i [image create photo p0 -width 500 -height 1]
Apparently an image with an invalid height does not have a width.
Upvotes: 1