- or download this
use Tk;
use strict;
use warnings;
- or download this
###Configurable Variables###
my $pixel_size = 20;
my $window_width = 1800;
my $window_height = 1000;
- or download this
#####create the Main Window#####
my $mw = new MainWindow(-title => "BACnet Brush 1.0");
$mw -> geometry("1800x1000"); #resize the main window
- or download this
#####Clear Button#####
# This button clears the screen
my $clear_button = $mw -> Button(-text => "Clear",-command => \&clear)
+ -> place(-x => $window_width*.5, -y => $window_height*.05);
- or download this
#####create the canvas#####
my $canv_width = .75*$window_width;
my $canv_height = .8*$window_height;
my $canvas = $mw -> Canvas(-width => $canv_width, -height => $canv_hei
+ght, -relief => "sunken");
$canvas -> place(-x => .1*$window_width, -y => .1*$window_height);
- or download this
#####creating the pixel grid on the canvas#####
#pixel size>
my $pixel_width = $pixel_size;>
my $pixel_height = $pixel_size;>
- or download this
#position variables for the grid>
my $init_x = 0;
my $init_y = 0;
my $next_x = $pixel_width;
my $next_y = $pixel_height;
- or download this
#the pixel grid
my @pixel_id; # this array stores all of the unique ids for each pixel
...
$init_y = $next_y;
$next_y = $next_y + $pixel_height;
}
- or download this
#####configuring the pixel grid ####
for( my $k = 1; $k <= scalar(@pixel_id); $k++)
...
$canvas->bind($k, "<M1-Enter>",
sub { $canvas->itemconfigure($l, -fill => "blue"); });
}
- or download this
##### Functions #####
...
MainLoop();