Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

You cannot have a science without measurement. -- R. W. Hamming


devel / comp.lang.tcl / Image create from barchart is always 400x400

SubjectAuthor
* Image create from barchart is always 400x400Cecil Westerhof
`* Image create from barchart is always 400x400Scott Pitcher
 `- Image create from barchart is always 400x400Cecil Westerhof

1
Image create from barchart is always 400x400

<8734xbw3a8.fsf@munus.decebal.nl>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=12781&group=comp.lang.tcl#12781

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Cecil@decebal.nl (Cecil Westerhof)
Newsgroups: comp.lang.tcl
Subject: Image create from barchart is always 400x400
Date: Sun, 12 Nov 2023 13:43:11 +0100
Organization: Decebal Computing
Lines: 27
Message-ID: <8734xbw3a8.fsf@munus.decebal.nl>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="6a61c7dbe6d78e723411f78a7f16a77e";
logging-data="111866"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18d88bgaN+gTS52uRsgAvbJRhFsQvGLbEg="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:BdlYBF7axr2AkMcCHOgd/5uCUec=
sha1:K/qhqB/xsKNJ4m+6kSwHWNhbjjY=
 by: Cecil Westerhof - Sun, 12 Nov 2023 12:43 UTC

I have the following code:
wm title . "YouTube Weekly Views"
blt::barchart .bc -plotbackground black
.bc axis configure y -stepsize 100
.bc element create best -xdata ${weekArr} -ydata ${viewsArr} -label {}
pack .bc -side top -expand yes -fill both

# Create a image to hold the graph, use the "snap" subcommand and then
# write the image to a file.
image create photo snapshot
.bc snap snapshot
snapshot write ${directory}${imageName} -format png
# Display the barchart
exec gwenview ${directory}${imageName} &
# exit

My views are going up and so are the weeks, but the generated image is
always 400x400.
The barchart itself is expanding, which I saw when putting the exit
into comment.
(At the moment I am only interested in the graphic file.)
So why does snapshot not honour the dimensions of the barchart?

--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

Re: Image create from barchart is always 400x400

<20231115085803.3625f3c1@officepc.svpts>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=12789&group=comp.lang.tcl#12789

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: scotty@svptechnicalservices.com.au (Scott Pitcher)
Newsgroups: comp.lang.tcl
Subject: Re: Image create from barchart is always 400x400
Date: Wed, 15 Nov 2023 08:58:03 +1100
Organization: SVP TECHNICAL SERVICES
Lines: 61
Message-ID: <20231115085803.3625f3c1@officepc.svpts>
References: <8734xbw3a8.fsf@munus.decebal.nl>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="771af0623a9fa2a8e0fc2d8867279453";
logging-data="1467228"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19jVfqJVpWDylrpd/styd08T1qTJLDqJTQ="
Cancel-Lock: sha1:KNvZL6yLWiEgzhn1SiC7aJHeyWs=
X-Newsreader: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu)
 by: Scott Pitcher - Tue, 14 Nov 2023 21:58 UTC

On Sun, 12 Nov 2023 13:43:11 +0100
Cecil Westerhof <Cecil@decebal.nl> wrote:

> I have the following code:
> wm title . "YouTube Weekly Views"
> blt::barchart .bc -plotbackground black
> .bc axis configure y -stepsize 100
> .bc element create best -xdata ${weekArr} -ydata
> ${viewsArr} -label {} pack .bc -side top -expand yes
> -fill both
>
> # Create a image to hold the graph, use the "snap" subcommand and
> then # write the image to a file.
> image create photo snapshot
> .bc snap snapshot
> snapshot write ${directory}${imageName} -format png
> # Display the barchart
> exec gwenview ${directory}${imageName} &
> # exit
>
> My views are going up and so are the weeks, but the generated image is
> always 400x400.
> The barchart itself is expanding, which I saw when putting the exit
> into comment.
> (At the moment I am only interested in the graphic file.)
> So why does snapshot not honour the dimensions of the barchart?
>

Hi Cecil,

To change the window size, add a -width and/or -height option to the
barchart, such as:

blt::barchart .bc -plotbackground black -width 1000 -height 300

or:

..bc configure -width 1000 -height 300

You won't get a snapshot the correct size just yet, so before you
say snap:

update idletasks

Then the window AND the snapshot image will be correct.

So:
..bc configure -width 1000 -height 300
update idletasks
image create photo snapshot
..bc snap snapshot
snapshot write ${directory}${imageName} -format png

Kind regards,
Scott

--

Re: Image create from barchart is always 400x400

<87edgruxe5.fsf@munus.decebal.nl>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=12792&group=comp.lang.tcl#12792

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!news.swapon.de!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Cecil@decebal.nl (Cecil Westerhof)
Newsgroups: comp.lang.tcl
Subject: Re: Image create from barchart is always 400x400
Date: Wed, 15 Nov 2023 11:24:50 +0100
Organization: Decebal Computing
Lines: 67
Message-ID: <87edgruxe5.fsf@munus.decebal.nl>
References: <8734xbw3a8.fsf@munus.decebal.nl>
<20231115085803.3625f3c1@officepc.svpts>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="8fa6579264456ac945371c28912f2d16";
logging-data="1804516"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Lqmrnl1KGvcUWVxf25Ywo5qg02JXiYmA="
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Cancel-Lock: sha1:mG4Qkcxrdg0kb2LbhJBtS7DTlxc=
sha1:wnZRQvj19QCk84ttasRr20TNers=
 by: Cecil Westerhof - Wed, 15 Nov 2023 10:24 UTC

Scott Pitcher <scotty@svptechnicalservices.com.au> writes:

> On Sun, 12 Nov 2023 13:43:11 +0100
> Cecil Westerhof <Cecil@decebal.nl> wrote:
>
>> I have the following code:
>> wm title . "YouTube Weekly Views"
>> blt::barchart .bc -plotbackground black
>> .bc axis configure y -stepsize 100
>> .bc element create best -xdata ${weekArr} -ydata
>> ${viewsArr} -label {} pack .bc -side top -expand yes
>> -fill both
>>
>> # Create a image to hold the graph, use the "snap" subcommand and
>> then # write the image to a file.
>> image create photo snapshot
>> .bc snap snapshot
>> snapshot write ${directory}${imageName} -format png
>> # Display the barchart
>> exec gwenview ${directory}${imageName} &
>> # exit
>>
>> My views are going up and so are the weeks, but the generated image is
>> always 400x400.
>> The barchart itself is expanding, which I saw when putting the exit
>> into comment.
>> (At the moment I am only interested in the graphic file.)
>> So why does snapshot not honour the dimensions of the barchart?
>>
>
> To change the window size, add a -width and/or -height option to the
> barchart, such as:
>
> blt::barchart .bc -plotbackground black -width 1000 -height 300
>
> or:
>
> .bc configure -width 1000 -height 300

That is not really necessary, because the window itself has a good
size. (For no at least.)

> You won't get a snapshot the correct size just yet, so before you
> say snap:
>
> update idletasks

That is what I needed. :-D

I now have:
pack .bc -side top -expand yes -fill both

# Create a image to hold the graph, use the "snap" subcommand and then
# write the image to a file.
# Make sure the snapshot has the right size
update idletasks
image create photo snapshot
.bc snap snapshot
snapshot write ${directory}${imageName} -format png

Thank you very much,

--
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor