Difference between revisions of "Dialog.pl"

From Organic Design wiki
(Change source-code blocks to standard format)
 
Line 1: Line 1:
 
Here's a simple example of brining up a unicode-friendly dialog box in Perl using Tk, I had to first install the '''perl-tk''' package.
 
Here's a simple example of brining up a unicode-friendly dialog box in Perl using Tk, I had to first install the '''perl-tk''' package.
{{code|<perl>
+
<source lang="perl">
 
#!/usr/bin/perl -w
 
#!/usr/bin/perl -w
 
use Tk;
 
use Tk;
Line 14: Line 14:
 
-buttons => [ "Ok" ]
 
-buttons => [ "Ok" ]
 
);
 
);
</perl>}}
+
</source>
 
[[Category:PERL]]
 
[[Category:PERL]]

Latest revision as of 18:11, 22 May 2015

Here's a simple example of brining up a unicode-friendly dialog box in Perl using Tk, I had to first install the perl-tk package.

#!/usr/bin/perl -w
use Tk;
use Tk::DialogBox;
use Encode qw( encode decode );

$mw = MainWindow->new;
$mw->withdraw();

$dialog = $mw->messageBox(
	-title   => "A unicode dialog box!",
	-message => decode( "UTF-8", "Eu não gosto de leite" ),
	-buttons => [ "Ok" ]
);