I rarely ever exhibit any patriotism, but here's my shot at it. (note: the code is ugly, yes, but it looks better when you run it.)
#!perl use Win32::GUI; Win32::GUI::Hide(scalar(Win32::GUI::GetPerlWindow())); $Win = new Win32::GUI::Window( -left => 226, -top => 230, -width => 538, -height => 357, -name => "Win", -text => "Stars & Stripes" ); $Win->Show(); $Win->AddButton( -text => "*", -name => "Star", -left => 0, -top => 0, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 160, -top => 0, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 40, -top => 0, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 120, -top => 0, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 80, -top => 0, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 20, -top => 20, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 60, -top => 20, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 100, -top => 20, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 140, -top => 20, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 180, -top => 20, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 0, -top => 40, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 80, -top => 40, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 120, -top => 40, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 160, -top => 40, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 200, -top => 40, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 20, -top => 60, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 60, -top => 60, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 101, -top => 60, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 140, -top => 60, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 180, -top => 60, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 0, -top => 80, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 200, -top => 80, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 40, -top => 80, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 80, -top => 80, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 120, -top => 80, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 200, -top => 0, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 40, -top => 40, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 160, -top => 80, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 20, -top => 100, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 140, -top => 100, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 180, -top => 100, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 60, -top => 100, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 100, -top => 100, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 120, -top => 120, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 40, -top => 120, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 0, -top => 120, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 80, -top => 120, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 200, -top => 120, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 160, -top => 120, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 20, -top => 140, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 180, -top => 140, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 140, -top => 140, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 100, -top => 140, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 60, -top => 140, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 80, -top => 160, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 120, -top => 160, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 160, -top => 160, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 200, -top => 160, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 40, -top => 160, -width => 20, -height => 20, ); $Win->AddButton( -text => "*", -name => "Star", -left => 0, -top => 160, -width => 20, -height => 20, ); $Win->AddButton( -text => "", -name => "Stripe", -left => 220, -top => 50, -width => 310, -height => 30, ); $Win->AddButton( -text => "", -name => "Stripe", -left => 220, -top => 0, -width => 310, -height => 30, ); $Win->AddButton( -text => "", -name => "Stripe", -left => 220, -top => 100, -width => 310, -height => 30, ); $Win->AddButton( -text => "", -name => "Stripe", -left => 220, -top => 150, -width => 310, -height => 30, ); $Win->AddButton( -text => "", -name => "Stripe", -left => 0, -top => 200, -width => 530, -height => 30, ); $Win->AddButton( -text => "", -name => "Stripe", -left => 0, -top => 250, -width => 530, -height => 30, ); $Win->AddButton( -text => "", -name => "Stripe", -left => 0, -top => 300, -width => 530, -height => 30, ); Win32::GUI::Dialog(); sub Win_Terminate { Win32::GUI::Show(scalar(Win32::GUI::GetPerlWindow())); return -1; }

______________________________________________
RIP
Douglas Noel Adams
1952 - 2001

Replies are listed 'Best First'.
Re: Stars & Stripes...
by premchai21 (Curate) on Sep 16, 2001 at 07:52 UTC
    Maybe you could put all your data in one place and avoid that redundancy, for instance:
    my ($stars, $stripes) = [[120,120],[50,682],[1952,2001]], # etcetera... [left,top] [[0,100],[0,150],[0,250]]; # etcetera... foreach (@$stars) { $Win->addButton( -text => '*', -name => 'Star', -left => $_->[0], -top => $_->[1], -width => 20, -height => 20) } # similar for stripes
    And with this, you could use map for patterns, such as:
    $stripes = [ map { [ 0, 50*$_ ] } (0..6) ]; # or something like that
    Just my $0.'02';
(crazyinsomniac: tk) Re: Stars & Stripes...
by crazyinsomniac (Prior) on Sep 16, 2001 at 12:55 UTC
    With the help of *saner* crazy tk xbm tingy (aka Tk XBM Editor), my colorfull tk version (I went to http://yahoo.com to look for a flag and found some interesting historical info...)
    #!/usr/bin/perl -w use strict; use Tk 8; my $MWin = new Tk::MainWindow(-background => 'white', -width => 630 , -height => 400 , ,); my $CANVAS = $MWin->Canvas(-width => 612 , -height => 340 , -background => "white", -borderwidth => 0, -highlightthickness => 0, -selectborderwidth => 0, ,)->pack(-expand => 'no', -anchor => 'center', ,); &make_us_up_the_stripes($CANVAS); &draw_us_up_the_stars($CANVAS); &MainLoop(); sub draw_us_up_the_stars { my ($C) = shift; my $star = q'#define star_width 20 #define star_height 16 static unsigned char star_bits[] = { 0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x06,0x00,0x00,0x0f,0x00,0x00,0x0f +,0x00, 0xfc,0xff,0x03,0xf8,0xff,0x01,0xf0,0xff,0x00,0xe0,0x7f,0x00,0xc0,0x3f +,0x00, 0xc0,0x3f,0x00,0xe0,0x7f,0x00,0xe0,0x79,0x00,0xf0,0xf0,0x00,0x30,0xc0 +,0x00, 0x00,0x00,0x00};'; $star = $C->Bitmap(-background => '#000099', -foreground => 'white', -data => $star, ,); ## the #000099 thing $C->create("rectangle", 1, 1, 244, 183, -fill => "#000099", ); #define star_width 20 #define star_height 16 #6 + 5 * 20 = 220 | 244 #5 + 4 * 16 = 144 | 183 ## the even rows of stars (odd # of stars, even # rows) for my $x (0..5) #6 { for my $y (0..4) #5 { $C->create('image', 22 + $x * 40, 25 + $y * 16 *2, -image => $star, ,); } } ## the even rows of stars (odd # of stars, even # rows) for my $x (0..4) #5 { for my $y (0..3) #4 { $C->create('image', 40 + $x * 40, 40 + $y * 16 * 2, -image => $star, ,); } } } sub make_us_up_the_stripes { ## thar be 13 stripes, 7 red, and 6 white my ($CANVAS) = shift; for(0..12) { printf "%s\n", my $color = ( ($_ % 2) == 0 ) ? "red" : "white"; printf "%s\n", $CANVAS->create('rectangle', 1, ( $_ * 26+ 1), 609 , ( ( $_ * 26 ) + 26 + 1), -fill => $color, ,); } }
    update: 9/24/2001 What, you want me to draw a star by hand???? Well I did and saved it as a Bitmap (the x-windows kind --- xbm).

     
    ___crazyinsomniac_______________________________________
    Disclaimer: Don't blame. It came from inside the void

    perl -e "$q=$_;map({chr unpack qq;H*;,$_}split(q;;,q*H*));print;$q/$q;"

      It looks like perl, but its not perl. So what is it?

      For the uninitiated out there crazyinsomniac whats with the C preprocessor stuff intermixed with perl?

      Yves
      --
      You are not ready to use symrefs unless you already know why they are bad. -- tadmc (CLPM)