Reply to thread

i have the following code


$mw = Tkx::widget->new(".");


for($i = 0, $i <= 8, $i++) {

use integer;

$board[$i] = $mw->new_ttk__button(-textvariable => \$state[$i], -command => sub {btnPressed($i);}, -width => 3)

                  ->g_grid(-row => ($i / 3) + 1, -column => ($i % 3) + 1);


}


it is supposed to arrange a 3x3 grid of buttons on the root window(this is going to be tic tac toe). right now it's just giving me a single button(maybe all 8 in the same position)


what's wrong and how can i fix it?


Loading…
Back
Top