2017-05-31 201 views
-2

我想在GUI中輸出某些東西,但不知道如何去做。如何在GUI輸出中使用printf

our $output=$mw_rtframe->Scrolled('Text',-scrollbars=>"se",-height=>25,-width=>150, -state=>'disable', -wrap=>'none')->pack(-side=>'left',-anchor=>'nw',-padx=>5,-pady=>5,-fill=>'both',-expand=>1); 

$output->configure(-state=>'normal'); 
$output -> insert ('end', " line %02x not match with line %02x : %02x != %02x \n", $address+($i)*16,$address1+($i)*16,$line[$j],$line1[$j]); 

但是當我的GUI輸出它並不顯示變量,但像這樣

8747687line %02x not match with line %02x : %02x != %02x 

東西輸出做工精細用printf的時候,但不能在GUI輸出。任何需要添加的東西在GUI中顯示?謝謝

+0

我可以知道爲什麼這個問題正在投入? – tim

回答

2

使用sprintf函數來格式化您的數據,然後將它傳遞到insert

+0

謝謝,它的工作原理 – tim