[Tkinter-discuss] scrolled canvas ,strange problem
johnmc
johnmc at velseis.com
Sun Sep 4 05:26:49 CEST 2011
On Sat, 3 Sep 2011 17:31:24 +0800, contro opinion wrote
> i have written a program in tkinter to draw stock graph,there are two
> strange thing i can't understand
> the attachment is 'AAU' data file(attachment 1).when you download it
> ,please save it in /tmp/AAU
> there is a scrolled canvas in it ,
>
> 1.strang long line,please see my attachment.
> i have see my data ,my formulation ,no wrong,but the line is so long!!
>
I haven't analysed it thoroughly, but your horizontal scale for the data does not match
the horizontal scale for your labels or motion reporting. The "long line" you see
actually matches the data on line 1089 in your data file. The date on this line is
2007-02-27.
> 2.there is no motion event reaction in the right of canvas,only
> motion event reaction in the left of canvas.
The IS a motion event throughout the entire canvas. Again, your problem seems to be
with your horizontal scale. The far right coordinate is 5710, yet you only report the
motion to 2764, the upper limit of self.xsqueen.
> 3.i have round function ,but the output is still more fractions than 2.
Whether you round a float or not has no impact on how it is displayed as a string. You
need to use the appropriate string formatting. If you want two decimal places try the
following format:
%.2f rather than %f. The rounding will also be properly handled by the string
formatting, so there will be no need to use the round function.
Regards,
John
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
More information about the Tkinter-discuss
mailing list