[Tutor] Change the font size of the lines and rectangle on aTkinter Canvas

Alan Gauld alan.gauld at btinternet.com
Tue Jan 16 01:33:20 CET 2007


"Asrarahmed Kadri" <ajkadri at googlemail.com> wrote

> I want to provide with a functionality of changing the font size, in 
> this
> case the width of the lines.
Its not really the font size. fonts only apply to text, its only
the line width you want to change. However todo that I
think the easiest way is just to elete the existing line
(and maybe the whole graph) and redraw with the new
parameters. Provideed the data has been precalculated
then this should be a rapid operation.


> Is it possible to do it dynamically; I mean the graph is
> already drawn, now with a Menu, suppose I want to
> provide the user with options of 50%, 100%
> and 200% font size.

You will need to store the line thicknesses in variables
so that the drawing routine can be parameter driven. Then
simply delete the existing graph and redraw it with the
new thickness - remember you may need to rescale
your axis to cater for thicker/thinner lines.

If you are using a filled Rectangle rather than a real line
(which is what I would actually expect to see in a bar chart)
then obviously the line thickness simply involves setting
the difference in the y coordinates appropriately.

Alan G. 




More information about the Tutor mailing list