Problem with tk and displaying on the screen

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

  1. #1

    Default Problem with tk and displaying on the screen

    I have just copied this program from a book (Active perl Developers Guide)

    I get an error:-

    Undefined subroutine &main::MainLoop called at tk2.pl line 28. (MainLoop();)

    What have I missed?

    Derek



    #win32 Activestate 5.8.0

    use strict;
    use warnings;
    use tk;

    my $main;
    my $label;
    my $button;
    my $icon;

    $main = MainWindow->new();
    $main->title("Hello World!");

    $label = $main->Label(text => 'Hello from tk!');
    $button = $main->Button();

    $icon = $button->Photo(-file => 'icon.gif');
    $button->configure(image => $icon,
    command => sub { exit; }
    );

    $label->pack(side => 'left');
    $button->pack(side => 'left',
    padx => 5
    );

    MainLoop();

    derek / nul Guest

  2. Similar Questions and Discussions

    1. Lost the on-screen visual intent of displaying "out-of-gamut" colors.
      I won't go into details on why I want this preference back, so I'll just keep this shorter by asking: For some reason I lost my ability to apply "out...
    2. FH 10 problem with EPS displaying
      I have problem, please help me. When I importing EPS files (without TIFF preview) in FH 10 for Win, I see only blank boxes. Where is the problem?...
    3. Problem displaying ASP pages
      I just setup a windows 2003 web edition server and having problems displaying asp page from the server. I set the web extensions in IIS to allow...
    4. Displaying an html page in a director screen, is it possible?
      The question says it all, is it possible to display an html page (wich is online) in Director. I am making an interactive cd-rom (with a friend of...
    5. problem when displaying image
      Hi, I made this code the retrive some info from my access DB, then choose another image from Products folder(images were not saved in DB)...
  3. #2

    Default Re: Problem with tk and displaying on the screen

    On Tue, 1 Jul 2003 18:44:50 +0200, "Markus W." <ehm.weihs@utanet.at> wrote:
    >Hi Derek!
    >
    >Try Tk::MainLoop();
    Undefined subroutine &tk::MainLoop called at tk2.pl line 28.

    ??
    >"derek / nul" <abuse@sgrail.org> schrieb im Newsbeitrag
    >news:6gc3gv0l5ujfdkmqhgl5v1rb2v78d1e314@4ax.com.. .
    >> I have just copied this program from a book (Active perl Developers Guide)
    >>
    >> I get an error:-
    >>
    >> Undefined subroutine &main::MainLoop called at tk2.pl line 28.
    >(MainLoop();)
    >>
    >> What have I missed?
    >>
    >> Derek
    >>
    >>
    >>
    >> #win32 Activestate 5.8.0
    >>
    >> use strict;
    >> use warnings;
    >> use tk;
    >>
    >> my $main;
    >> my $label;
    >> my $button;
    >> my $icon;
    >>
    >> $main = MainWindow->new();
    >> $main->title("Hello World!");
    >>
    >> $label = $main->Label(text => 'Hello from tk!');
    >> $button = $main->Button();
    >>
    >> $icon = $button->Photo(-file => 'icon.gif');
    >> $button->configure(image => $icon,
    >> command => sub { exit; }
    >> );
    >>
    >> $label->pack(side => 'left');
    >> $button->pack(side => 'left',
    >> padx => 5
    >> );
    >>
    >> MainLoop();
    >>
    >
    derek / nul Guest

  4. #3

    Default Re: Problem with tk and displaying on the screen

    good call and thank you.

    The use tk; was wrong

    put in use Tk; and all is well

    many thanks

    On Tue, 1 Jul 2003 19:00:45 +0200, "Markus W." <ehm.weihs@utanet.at> wrote:

    ,snip>
    >Did you write
    > tk::MainLoop()
    >or
    > Tk::MainLoop()
    >?
    >
    >
    >> >> #win32 Activestate 5.8.0
    >> >>
    >> >> use strict;
    >> >> use warnings;
    >> >> use tk;
    ^^^^^^^^^^^^^^^^^^^^
    >> >> my $main;
    >> >> my $label;
    >> >> my $button;
    >> >> my $icon;
    >> >>
    >> >> $main = MainWindow->new();
    >> >> $main->title("Hello World!");
    >> >>
    >> >> $label = $main->Label(text => 'Hello from tk!');
    >> >> $button = $main->Button();
    >> >>
    >> >> $icon = $button->Photo(-file => 'icon.gif');
    >> >> $button->configure(image => $icon,
    >> >> command => sub { exit; }
    >> >> );
    >> >>
    >> >> $label->pack(side => 'left');
    >> >> $button->pack(side => 'left',
    >> >> padx => 5
    >> >> );
    >> >>
    >> >> MainLoop();
    >> >>
    >> >
    >>
    >
    derek / nul Guest

  5. #4

    Default Re: Problem with tk and displaying on the screen


    "derek / nul" <abuse@sgrail.org> wrote in message
    news:q2g3gvka9ougjqmk7ejjhvga0n8b7hhbmj@4ax.com...
    > good call and thank you.
    >
    > The use tk; was wrong
    This is a nasty little feature of Windows (or any case-insensitive OS)
    When it looks for the file to 'use', it succeeds since the OS is doing
    the searching in a case-insensitive manner. When perl looks for the
    functions
    that were imported, it does it itself in a case-sensitive manner and fails!

    Anyone know of a way to fix this?

    -brian


    {snip rest of thread}


    Brian Helterline Guest

  6. #5

    Default Re: Problem with tk and displaying on the screen

    Brian Helterline wrote:
    > "derek / nul" <abuse@sgrail.org> wrote in message
    > news:q2g3gvka9ougjqmk7ejjhvga0n8b7hhbmj@4ax.com...
    ....
    > This is a nasty little feature of Windows (or any case-insensitive OS)
    > When it looks for the file to 'use', it succeeds since the OS is doing
    > the searching in a case-insensitive manner. When perl looks for the
    > functions
    > that were imported, it does it itself in a case-sensitive manner and fails!
    >
    > Anyone know of a way to fix this?

    use Linux;-)
    >
    > -brian
    --
    Bob Walton

    Bob Walton Guest

  7. #6

    Default Re: Problem with tk and displaying on the screen

    On Tue, 1 Jul 2003 14:06:03 -0700, "Brian Helterline"
    <brian_helterline@hp.com> wrote:
    >> The use tk; was wrong
    >
    >This is a nasty little feature of Windows (or any case-insensitive OS)
    >When it looks for the file to 'use', it succeeds since the OS is doing
    >the searching in a case-insensitive manner. When perl looks for the
    >functions that were imported, it does it itself in a case-sensitive
    >manner and fails!
    >
    >Anyone know of a way to fix this?
    Learn to spell properly.
    Helgi Briem 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