Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
does perl Tk supports things like radio buttons,dropdown list,

Have you looked at the widget demo that comes with Tk? It contains radio button and dropdown list examples. Just type "widget" at a command prompt if you have Tk installed, or look in the Tk source/demos directory for the widget demo.

Other than Tk, I also like Gtk2 for GUI's.

Just in case you have a hard time wrangling the code out of the demo's, here are a couple of simple examples.


#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = MainWindow->new; my $rb = 'first button'; my $rb1 = $mw->Radiobutton(-text => "Button One", -value => 'button1', -variable => \$rb)->pack; my $rb2 = $mw->Radiobutton(-text => "Button Two", -value => 'button2', -variable => \$rb)->pack; my $b1 = $mw->Button(-text => 'Show', -command => [ \&showRB, \$rb ])- +>pack; MainLoop; sub showRB { print "Arg list is @_ \n"; my $state_ref = shift; my $state = $$state_ref; print "$state\n"; $mw->messageBox(-title => 'Status', -type => 'OK', -message => "Status is :$state:."); }
and a drop down menu
#!/usr/bin/perl use warnings; use strict; use Tk; my $top = MainWindow->new; $top->geometry('200x200+100+100'); # Menubar my $menu = $top->Frame(-relief => 'raised', -bd => 2); my $menu_pulldown = $menu->Menubutton(-text => "Test", -underline => 0); $menu_pulldown->command(-label => "Exit", -command => sub { exit 0 }); # Cascade Menu $menu_pulldown->cascade(-label => "Cascade", -underline => 1,); my $newmenu = $menu_pulldown->cget(-menu)->Menu; $menu_pulldown->entryconfigure('last', -menu => $newmenu); $newmenu->command(-label => "CascadeCommand", -command => sub { exit 0 }); $menu->pack(-side => 'top', -fill => 'x'); $menu_pulldown->pack(-side, 'left'); MainLoop;

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh

In reply to Re: perl Tk help by zentara
in thread perl Tk help by ansh batra

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others perusing the Monastery: (3)
    As of 2020-12-02 17:24 GMT
    Find Nodes?
      Voting Booth?
      How often do you use taint mode?

      Results (44 votes). Check out past polls.