in reply to Tk::LCD Investigations
G'day James,
++ It worked as described for me.
There's an unlimited amount of times that "next" can be used. You may want to add a limit. At the moment, for the first several uses, the proportions are retained; something like this:
+-----+ | | | | | O | | | | O | | | | | +-----+
After half a dozen uses, the layout degrades; very roughly like this:
+-----+ +-----+ +-----+ +-----+ | | | | | | | | | | | | | | | | | O | | O | | O | | O | | | | | | | | | | O | | O | | O | +-----+ | | | | +-----+ | | +-----+ +-----+
As a general rule-of-thumb in Tk applications, unless I want to pass an absolute value to a callback which doesn't change that value, I use references. In many cases, even if the value isn't being changed in the callback, it may be changed prior to the callback being invoked; references are typically a good option in these cases also.
You also may want add a "prev" button to test down-scaling.
Not intended as a huge criticism, but I do see the following code repeated:
$canvas->createPolygon(@scaledBox, -fill => 'darkgreen'); $canvas->createOval(@scaledTopColon, -fill => 'yellow'); $canvas->createOval(@scaledBotColon, -fill => 'yellow');
Consider abstracting that into a single routine. If you subsequently want to change something, you'll only need to do it in one place (see "DRY principle").
— Ken
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Tk::LCD Investigations
by jmlynesjr (Deacon) on Mar 16, 2023 at 14:54 UTC |