I don't have an answer for you but I can confirm what you're seeing. I also ran some additional tests. I'm using: macOS Sierra 10.12.5; Perl 5.28.0; Tk 804.034; XQuartz 2.7.11; and, xorg-server 1.18.4.

Firstly, for all tests, I wrapped the code you posted in:

#!/usr/bin/env perl use strict; use warnings; use Tk; my $mw = MainWindow::->new(); ... MainLoop;

[It's best to show code that can be run directly. It makes it easier for us to test. It also means that a potential problem, in the code you haven't shown, can be detected. SSCCE has more about this.]

With your code, I see a ".apple" menu button which has an empty dropdown list. The system (apple-icon) menu is unchanged.

I added this line (after "my $applemenu = ..."):

$applemenu->command(-label => 'Hello', -command => sub { print "Hello\ +n" });

The ".apple" dropdown list now has this item which works as expected. Again, the system (apple-icon) menu is unchanged.

I also tried without the toplevel:

my $menubar = $mw->Menu(-type => 'menubar'); ... $mw->configure(-menu => $menubar);

This also works for the ".apple" menu; but the system (apple-icon) menu is still unchanged.

I'll front-page your post to give it a wider audience as I'd anticipate reduced attendance over the next few days. I'm also personally interested in an answer to this. [Update: haukex front-paged it while I was composing my reply.]

Finally, just as a side note, Perl's Tkx and Tk are both based on tcl/tk. Tkx is just a thin wrapper around it. Tk uses code based on it; for example, see the first line of the Tk::Menu source:

# Converted from menu.tcl --

Although both have superficial similarities in various places, they are quite different. As a quick example:

$mw->Button(...)->pack; # Tk $mw->new_button(...)->g_pack; # Tkx

— Ken


In reply to Re: Tk menu Apple macOS by kcott
in thread Tk menu Apple macOS by Anonymous Monk

Title:
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, details, 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, summary, 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.