CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Intermediate: Re: [PapaGeek] Multi Menu, multi-function Tk Ap: Edit Log

Veteran / Moderator

Mar 12, 2014, 7:43 AM

Views: 7521
Re: [PapaGeek] Multi Menu, multi-function Tk Ap

Rather than creating multiple independent MainWindow objects, it's preferable to use Tk::Toplevel to create the child windows.

Here's an example pulled from a similar question on perlmonks.

use warnings;
use strict;
use Tk;

my $mw = tkinit;

my $top = $mw->Toplevel();
$top->configure(-title=>'Fruit Menu');

my $ls_show_fruit = $top->Scrolled('Listbox',
-scrollbars=>'se' ,
-selectmode =>'single'


$top->Button(-text => 'Ok',
-command => sub{



$mw->Button(-text=> 'select_fruit',
-command => sub{



While it is common to use a button widget to create a child window, IMO it's better to use Tk::Menu to create a standard menubar with links that create the child windows and then use button widgets to preform specific tasks within the window.

(This post was edited by FishMonger on Mar 12, 2014, 7:46 AM)

Edit Log:
Post edited by FishMonger (Veteran) on Mar 12, 2014, 7:46 AM

Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives