The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


Tk::Airports - A widget to select airports


  use Tk;
  use Tk::Airports;
  my $mw = MainWindow->new();
  $airport = $mw->Airports(-title => 'AirportsWoldWide');
  my @return_values = $airport->Show();
  # or as one string
  my $return_value = $airport->Show();


Name: selectMode
Class: SelectMode
Switch: -selectmode

Specifies one of several styles for manipulating the selection. The value of the option may be arbitrary, but the default bindings expect it to be either single, multiple or extended; the default value is single.

Name: font
Class: Font
Switch: -font

Specifies the font for the list of Airports. The default font is "Courier 8"

Name: title
Class: Title
Switch: -title

Specifies the title of the widget.

Name: order
Class: Order
Switch: -order

It is possible to change the order. The list can be ordered by Airport-Code (code) or by City-Name (city). The default value is code.

Name: filename
Class: Filename
Switch: -filename

Specifies a file that contains a user specific set of Airports


The Airports method creates a new window and shows a list of nearly all airports. The widget provides several functions:

Search for an airport with the entry at the top of the widget.

The return values are the codes for the airports. In list context a list with one code per element is returned, in scalar context a string is returned with "; " as delimiter.


The Airports method creates a widget object. This object supports the configure and cget methods described in Tk::options which can be used to enquire and modify the options described above. The widget also inherits all the methods provided by the generic Tk::Widget class.


The following additional behavior is defined by the default bindings:


Start the search via <Return> in the Entry at the top of the widget.


Return the selected values via <Return> in the listbox.


Return one selected value via double-clicking the entry in the listbox.


Please contact me when you have found a bug.


*) translation of cities into national names *) allow other fonts *) option for specifying the return values (code,city,all) *) option for specifying the delimiter

document these methods:



Renee Baecker, <>


Copyright (C) 2006 - 2009 by Renee Baecker

This library is free software; you can redistribute it and/or modify it under the terms of Artistic License 2.0