Tkx::Tutorial

Tkx::Tutorial Perl module contains a tutorial about how to use Tkx.
Download

Tkx::Tutorial Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • ActiveState
  • Publisher web site:
  • http://search.cpan.org/~gaas/pyperl-1.0/Python-Object/Object.pm

Tkx::Tutorial Tags


Tkx::Tutorial Description

Tkx::Tutorial Perl module contains a tutorial about how to use Tkx. Tkx::Tutorial Perl module contains a tutorial about how to use Tkx.Tk is a toolkit that allows you to create applications with graphical interfaces for Windows, Mac OS X and X11. The Tk toolkit is native to the Tcl programming language, but its ease of use and cross-platform availability has made it the GUI toolkit of choice for many other dynamic languages as well.Tkx is a Perl module that makes the Tk toolkit available to Perl programs. By loading the Tkx module Perl programs can create windows and fill them with text, images, buttons and other controls that make up the user interface of the application.Hello WorldLet's start with the mandatory exercise of creating an application that greats the world. Here we make the application window contain a single button which will shut down the application if clicked. The code to make this happen is: use Tkx; Tkx::button(".b", -text => "Hello, world", -command => sub { Tkx::destroy("."); }, ); Tkx::pack(".b"); Tkx::MainLoop()Save this to a file called hello.pl and then run perl hello.pl to start up the application. A window with the text "Hello, world" should appear on your screen.After the Tkx module has been loaded by the use Tkx statement the application will show an empty window called ".". We create a button with the name ".b" and tell the window to display the button with the call to Tkx::pack(). After the layout of the window has been set up we need to pass control back to Tk so that it can draw the window and invoke our callback if the button is clicked. This is achieved by the Tkx::MainLoop() call at the end. Clicking the button will invoke the subroutine registered with the -command option of the button. In this case the callback simply destroys the window, which in turn will terminate the application. Requirements: · Perl


Tkx::Tutorial Related Software