ff has asked for the wisdom of the Perl Monks concerning the following question:

Hi PerlMonks,
Thanks for your postings here and I hope to help someone someday as much as I've been helped.

I'm using ActiveState Perl for Windows and my Tk program has a little menubar at the top left.

I have set
relief => 'flat'
for the menubar because I stick some 'flat' Buttons next to the menu and by everything being 'flat', users cannot easily tell that there are different types of widgets on the top line. (Except for a little bit of choppy spacing between the menubar and the Button(s).) Well, I want one of the buttons to be a Checkbutton, but I'm reading in the old "Learning Perl/Tk" by Nancy Walsh that "the -relief option is ignored completely when -indicatoron is set to 0." p. 89. Grrr.

I don't want to have a little square indicator box (esp. when it turns purple!) in the middle of my menu. Is there a way to achieve the effect of:
-relief => 'flat',
-indicatoron => '0',
for a Checkbutton simultaneously, contrary to the quote above?

(The checkbutton opens Notepad.exe against a certain log file, it turns color based on the severity of things I write to that log file, and some other minor things.)

Thanks,
Brig
  • Comment on flat Tk Checkbutton in menu w/o indicator

Replies are listed 'Best First'.
Re: flat Tk Checkbutton in menu w/o indicator
by hiseldl (Priest) on Oct 09, 2002 at 14:37 UTC

    Here's a slightly different way that you could do it. If you just need an indicator that you can click on, you can use a button with different images for different levels of severity and bind the button to open notepad.

    $mw = MainWindow->new; $images{severity1} = $mw->Photo(-file=>"sev1.xpm", -format=>'xpm'); $images{severity2} = $mw->Photo(-file=>"sev2.xpm", -format=>'xpm'); $images{severity3} = $mw->Photo(-file=>"sev3.xpm", -format=>'xpm'); $severity_button = $mw->Button( -image => $images{severity1}, # The default severity -width=>16, -height=>16, -command => \&CallNotepad); ... sub ChangeToSeverity2 { $severity_button->configure(-image => $images{severity2}); }

    Since you are already putting buttons in your menu, this should not take too much effort to implement.

    --
    hiseldl
    What time is it? It's Camel Time!