⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scale.pl

📁 perl learn perl by examples
💻 PL
字号:
use Tk;# Show Celsius/Fahrenheit equivalence using scales.$top = MainWindow->new();$celsius_val = 50;compute_fahrenheit();$top->Scale('-orient'       => 'horizontal',            '-from'         => 0,                    # From 0 degrees C            '-to'           => 100,                  # To 100 degrees C            '-tickinterval' => 10,            '-label'        => 'Celsius',             '-font'         => '-adobe-helvetica-medium-r-normal--10-100-75-75-p-56-iso8859-1',            '-length'       => 300,                  # in pixels            '-variable'     => \$celsius_val,        # global variable            '-command'      => \&compute_fahrenheit  # Change fahrenheit            )->pack('-side' => 'top',                    '-fill' => 'x');$top->Scale('-orient'       => 'horizontal',            '-from'         => 32,                   # From 32 degrees F            '-to'           => 212,                  # To 212  degrees F            '-tickinterval' => 20,                   # tick every 20 degrees            '-label'        => 'Fahrenheit',             '-font'         => '-adobe-helvetica-medium-r-normal--10-100-75-75-p-56-iso8859-1',            '-length'       => 300,                  # In pixels            '-variable'     => \$fahrenheit_val,     # global variable            '-command'      => \&compute_celsius     # Change celsius            )->pack('-side' => 'top',                    '-fill' => 'x',                    '-pady' => '5');sub compute_celsius {    # The celsius scale's slider automatically moves when this     # $celsius_val is changed    $celsius_val = ($fahrenheit_val - 32)*5/9;}sub compute_fahrenheit {    $fahrenheit_val = ($celsius_val * 9 / 5) + 32;}MainLoop();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -