SPUG: Tk question.

Ron Hartikka ronh at iainc.com
Wed Sep 20 10:00:45 CDT 2000


Hi,

The code below puts three Frames in a MainWindow.

I want one Frame to occupy the top half of the MainWindow and the other two
to split the bottom half. To get this when I put a Canvas in the top Frame,
I find I need to make the Canvas 8 pixels smaller than the Frame.

Why?

I looked in Tk docs, but couldn't find anything that explained this (to me,
anyway).

I'd like to know so that I don't paint myself into a corner.

Whatever the explanation, is hardcoding the 8 pixels a safe way to handle
the issue?

Any other comments on the code welcome.

Thanks.

Ron Hartikka
    Interautomation, Inc.
    email    => ronh at iainc.com
    Dearborn => 313-248-5401
    Mobile   => 734-216-2845

##################################################


use Tk;
use strict;

ui();

sub ui{
	my $scale = 1.5;
	my $scale_v = 2 * $scale;
	my $scale_h = 5 * $scale;
	my $graph_height = $scale_v * 100;
	my $graph_width = $scale_h * 100;
	my $policy_height = $graph_height;
	my $policy_width = $graph_width / 2;

	my $mw =MainWindow->new;

	my $fr_graph = $mw->Frame(-height => $graph_height,
								-width => $graph_width,
								-relief => 'raised',
								-borderwidth => 2)->pack();

	my $fr_policy = $mw->Frame(-height => $policy_height,
								-width => $policy_width,
								-relief => 'raised',
								-borderwidth => 2)->pack(-side => 'left');

	my $fr_shift = $mw->Frame(-height => $policy_height,
								-width => $policy_width,
								-relief => 'raised',
								-borderwidth => 2)->pack(-side => 'left');

	my $canvas = $fr_graph->Canvas(-height => $graph_height,
								-width => $graph_width-8)->pack();

	MainLoop();
}


 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/





More information about the spug-list mailing list