"<table></table>" and "<frameset><frame></frame></frameset>" in perl/tk

Ask a Question related to PERL Beginners, Design and Development.

  1. #1

    Default "<table></table>" and "<frameset><frame></frame></frameset>" in perl/tk

    Dear my friends...

    Anybody would be so kind telling me what is similar in
    perl/tk to arrange the location of a form written in
    perl/tk? I want a nice look for my perl/tk
    application.
    Somewhat like this below:
    1. Name : <place to type-in>
    2. Address : <place to type-in>
    3. Telephone : <place to type-in>

    I have made the main menu of my application with
    "Menubutton". And I want if the user click on the menu
    that what the user see is only the aimed application
    displayed on the determined area (under the main menu)
    but the menu has no change in position and form.
    Somewhat like on HTML:
    ===
    <frameset><frame name=mainmenu
    src=mainmenu.html></frame><frame
    name=display></frame></frameset>
    ===
    <!--mainmenu.html :-->
    <table>
    <ol>
    <tr><td colspan=2>Main menu :</td></tr>
    <tr><td>1.</td><td><a href="biodata.html"
    target="display">biodata</a></td></tr>
    </table>
    ===
    So the mainmenu will not have any change only the
    content of the display frame will have change as the
    user work with this application main menu.

    Thank you very much in advance.
    ===
    #my current perl/tk code:
    #!/usr/bin/perl -w
    use Tk;
    my $mw = MainWindow->new;
    $mw->title("i\@m NA - Linux Server Administrating
    Tool");

    $frmm = $mw -> Frame(-borderwidth => 2,
    -relief =>
    'ridge')->pack(-side => 'top',

    -anchor => 'n',

    -expand => 1,

    -fill => 'x');

    $mobject = $frmm -> Menubutton(-text => "Administrated
    Object",

    -menuitems => [['command' => "Samba",

    -command => \&menusamba],

    ['command' => "Squid",

    -command =>
    \&menusquid]])->pack(-side =>
    'left',


    -anchor => 'nw',


    -expand =>0);
    $msetting = $frmm -> Menubutton(-text =>
    "Setting")->pack(-side => 'left',


    -anchor => 'nw',


    -expand => 0,


    -after => $mobject);
    $mfile = $frmm -> Menubutton(-text => "File",

    -tearoff => 0,

    -menuitems => [["command" => "New Document",

    -command =>
    \&new_document],

    "-"

    ])->pack(-side =>
    'left',


    -anchor => 'nw',


    -expand => 0,


    -after => $msetting);
    $doc_num = 1;
    $doc_list_limit = 9;
    $mw -> Button(-text => "New Document",
    -command =>
    \&new_document)->pack(-side =>
    'bottom',

    -anchor =>
    'e');
    $entry = $mw->Entry(-width => 80)->pack(-expand => 1,

    -fill => 'both');

    $mexit = $frmm -> Button(-text => "Exit",
    -command
    => \&keluar,

    -borderwidth => 0)->pack(-side => 'left',

    -anchor =>
    'nw',

    -expand => 0,


    -after =>
    $mfile);
    $mhelp = $frmm -> Menubutton(-text =>
    "Help")->pack(-side => 'right',

    -anchor =>
    'ne',

    -expand =>
    0);

    $judul = $mw->Label(-text => "Network Administrator
    Main Menu",
    -anchor =>
    'center')->place(-y => 30,

    -x => 0);

    MainLoop;

    sub keluar{
    exit();
    }

    sub menusamba{
    $judul = $mw->Label(-text => "");
    }

    sub new_document{
    my $name = "Document $doc_num";
    $doc_num++;

    push (@current,$name);
    $filem->command(-label => "$name",
    -command => [
    \&select_document, $name ]);
    &select_document($name);
    if ($#current > $doc_list_limit){
    $filem->menu->delete(2);
    shift(@current);
    }
    }

    sub select_document {
    my ($selected) = @_;
    $entry->delete(0,'end');
    $entry->insert('end',"SELECTED DOCUMENT:
    $selected");
    }

    __________________________________
    Do you Yahoo!?
    Yahoo! SiteBuilder - Free web site building tool. Try it!
    [url]http://webhosting.yahoo.com/ps/sb/[/url]
    Prabu Subroto Guest

  2. Similar Questions and Discussions

    1. #39657 [NEW]: The extended table-specification "database.table" creates errors
      From: w dot kaiser at fortune dot de Operating system: XP Pro PHP version: 4.4.4 PHP Bug Type: MySQL related Bug...
    2. #39657 [Opn]: The extended table-specification "database.table" creates errors
      ID: 39657 User updated by: w dot kaiser at fortune dot de Reported By: w dot kaiser at fortune dot de Status: Open...
    3. Frameset and "border"
      I am starting to use Dreamweaver and to begin with created a frameset with top, left and right frames. The problem is that under the top frame...
    4. "dinamic_menu" in Frameset?
      Hi I have tried a Flash menu, "dinamic_menu", and I hope someone can help me with linking the menu so it can be used in a Frameset. From one Frame...
    5. animation "open" onPress( animation "close" ) go to Frame "myFrame"
      I have searched hi and low for the answer and nothing has helped me as of yet. My Main timeline is sectioned off by keyframes that are 10 frames...
  3. #2

    Default Re: "<table></table>" and "<frameset><frame></frame></frameset>" in perl/tk

    Prabu Subroto wrote:
    > Dear my friends...
    >
    > Anybody would be so kind telling me what is similar in
    > perl/tk to arrange the location of a form written in
    > perl/tk? I want a nice look for my perl/tk
    > application.
    > Somewhat like this below:
    > 1. Name : <place to type-in>
    > 2. Address : <place to type-in>
    > 3. Telephone : <place to type-in>
    Thanks, prabu,

    The simple explanation above helps us undestand what you are trying
    to do. I'm not sure what the code you included has to do with this
    though. There are a number of problems with it--enough that I
    would suggest that you take things one step at a time when learning
    Tk. The Tk library is a large and somewhat complicated animal.
    Each widget you put on a window makes things just a little more
    complicated, and debugging just a little bit harder.

    I recommend adding widget one at a time to your Tk interface, and
    thoroughly testing the widget as is bfore moving on.

    For instance, the Entry widget in the script as posted seemed to
    not work, and could have been dangerous. That is because you used
    a different packing manager, the placer, to put it in the same
    frame as items that had been packed:
    $judul = $mw->Label(-text => "Network Administrator Main Menu",
    'center')->place(-y => 30,

    -x => 0);


    As posted, the text enetered by the user was hidden behind the
    large command button. Changing the place command to a simple pack
    made it possible to see the output. You might not like the visual
    effect, but it is more important that your widgets do their job.
    You can jigger the fine details of placement once you know that the
    interface functions.

    From what I see of your code, there should be no need to worry
    about geometry of the main workspace at all. Your workspace is a
    single-document interface. When you open a file or select a new
    document, the text widget that holds the document's contents should
    be cleared. The code looks very close to what it will take.

    I would recommend rebuilding this one widget at a time, and making
    sure that you understand how each widget is working before you put
    the next one on. Yes, this is a lot of work. [*shrug*] Goes with
    the territory.

    Also, some tips on code formatting:

    If you use hanging indents, use them well. This style calls for
    the => operators to be aligned vertically within each set of
    name-value pairs. This helps understand what goes together when
    review, editing and debugging code.

    Also, blank lines should appear only when there is some break in
    flow that you wish to signal. You should *NEVER* have a blank line
    in the middle of a statement, especially if the statement is a
    function call. I am including a re-format of your code to give you
    an idea of how it might work better.

    So where are you in your study of the Tk library? How much have
    you worked with it? There is a definite and steep learning curve
    to Tk, but it does function very well.

    #my current perl/tk code:
    #!/usr/bin/perl -w
    use Tk;
    my $mw = MainWindow->new;
    $mw->title("i\@m NA - Linux Server Administrating
    Tool");

    $frmm = $mw -> Frame(-borderwidth => 2,
    -relief =>'ridge')->pack(
    -side => 'top',
    -anchor => 'n',
    -expand => 1,
    -fill => 'x');

    $mobject = $frmm -> Menubutton(-text => "Administered Object",
    -menuitems => [['command' => "Samba",
    -command => \&menusamba],
    ['command' => "Squid",
    -command => \&menusquid]])->pack(
    -side =>'left',
    -anchor => 'nw',
    -expand => 0);

    $msetting = $frmm -> Menubutton(-text => "Setting")->pack(
    -side => 'left',
    -anchor => 'nw',
    -expand => 0,
    -after => $mobject);

    $mfile = $frmm -> Menubutton(-text => "File",
    -tearoff => 0,
    -menuitems => [["command" => "New Document",
    -command => \&new_document],
    "-"])->pack(
    -side => 'left',
    -anchor => 'nw',
    -expand => 0,
    -after => $msetting);

    $doc_num = 1;
    $doc_list_limit = 9;
    $mw -> Button(-text => "New Document",
    -command => \&new_document)->pack(
    -side => 'bottom',
    -anchor => 'e');

    $entry = $mw->Entry(-width => 80)->pack(
    -expand => 1,
    -fill => 'both');

    $mexit = $frmm -> Button(-text => "Exit",
    -command => \&keluar,
    -borderwidth => 0)->pack(-side => 'left',
    -anchor => 'nw',
    -expand => 0,
    -after => $mfile);

    $mhelp = $frmm -> Menubutton(-text => "Help")->pack(
    -side => 'right',
    -anchor => 'ne',
    -expand => 0);

    $judul = $mw->Label(-text => "Network Administrator Main Menu",
    -anchor => 'center')->pack();

    MainLoop;

    sub keluar{
    exit();
    }

    sub menusamba{
    $judul = $mw->Label(-text => "");
    }

    sub new_document{
    my $name = "Document $doc_num";
    $doc_num++;

    push (@current,$name);
    $filem->command(-label => "$name",
    -command => [\&select_document, $name ]);
    &select_document($name);
    if ($#current > $doc_list_limit){
    $filem->menu->delete(2);
    shift(@current);
    }
    }

    sub select_document {
    my ($selected) = @_;
    $entry->delete(0,'end');
    $entry->insert('end',"SELECTED DOCUMENT:$selected");
    }


    Joseph

    R. Joseph Newton Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139