Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

perl/tk

Name: Anonymous 2011-08-31 21:10

Hey guys, I somehow screwed up this code. When it runs, it compiles fine, but then it just opens a blank command prompt window. Tk is installed properly, and I can get a basic hello world program running perfectly.

#!/usr/bin/perl
use strict;
use warnings;
use diagnostics;
use Tk;
srand;


my $timelimits = 1;
(A ton of arrays were here)

my $mw = new MainWindow;
my $title = $mw -> Label(-text=>"Starcraft Strategy Generator") -> grid();
my $howmany = $mw -> Label(-text=>"How many strategies?") -> grid();
my $ent = $mw -> Entry() -> grid();
my $button = $mw -> Button(-text=>"Generate Strategies", -command => \&push_button) -> grid();
my $checkminutes = $mw -> Checkbutton(-text=>"Use time limits?", -variable=>\$timelimits) -> grid();
$checkminutes -> deselect();
my $output = $mw -> Text(-width=>500, -height=> 240) -> pack();

MainLoop;

sub push_button {

my $builds = $ent -> get();

while(0<$builds) {
if($timelimits == 1) {
my $numbersrand = rand @numbers;
my $buildingrand = rand @building;
my $adverbrand = rand @adverb;
my $verbrand = rand @verb;

my $numbersout = $numbers[$numbersrand];
my $minuteout = "Minute";
my $buildingout = $building[$buildingrand];
my $adverbout = $adverb[$adverbrand];
my $verbout = $verb[$verbrand];

$output -> insert('end',"$numbersout $minuteout $buildingout $adverbout $verbout\n");
$builds --;
}
else
{

my $numbersrand = rand @numbers;
my $buildingrand = rand @building;
my $adverbrand = rand @adverb;
my $verbrand = rand @verb;

my $numbersout = $numbers[$numbersrand];
my $buildingout = $building[$buildingrand];
my $adverbout = $adverb[$adverbrand];
my $verbout = $verb[$verbrand];

$output -> insert("$numbersout $buildingout $adverbout $verbout\n");
$builds --;
}
}
$output -> insert("Done\n");
}

Name: Anonymous 2011-08-31 21:23

Back to /g/, please.

Name: Anonymous 2011-08-31 21:27

I already went to /g/!

Name: Anonymous 2011-08-31 21:28

What are you using /tk/ for?

Back to /sci/, please.

Also, #Windows.

Name: Anonymous 2011-08-31 21:32

I tried /sci/ too, and they said the same thing. Im using tk because I dont know any other languages that can be used to make a GUI, and I dont really feel like learning a new language just to make this program.

Name: Anonymous 2011-08-31 22:00

>>1
Dear faggot... use code tags please

Name: Anonymous 2011-09-01 3:44

>>5
http://perlqt.sourceforge.net/

Here you go, now you have three problems.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List