Stupid (very) question about menu Widget 
Author Message
 Stupid (very) question about menu Widget

Hi!

I'm trying create one "menu" widget with just this code:

menu .bla
pack .bla

Well, I receive one error saying something about toplevel window.

So... I use ". configure -menu .bla" and all work fine.

Just one question:

For my menu be created I ever must use "window configure -menu name_of_menu"??!!

Or I don't make something obvious?

Thanks!
Alexander - The worse english of the Earth.
Brazil - Rio de Janeiro



Mon, 02 Oct 2006 05:24:55 GMT  
 Stupid (very) question about menu Widget

Quote:

> Hi!

> I'm trying create one "menu" widget with just this code:

> menu .bla
> pack .bla

> Well, I receive one error saying something about toplevel window.

> So... I use ". configure -menu .bla" and all work fine.

> Just one question:

> For my menu be created I ever must use "window configure -menu name_of_menu"??!!

You created it with the menu command.  The configure causes it to be
displayed.

No, but it is most likely the best way.

Quote:
> Or I don't make something obvious?

Menus are not like most widgets.  Menus must be hooked to either
menubuttons (discouraged) or a toplevel (recommended) to be visible.

--
+--------------------------------+---------------------------------------+
| Gerald W. Lester               | "The man who fights for his ideals is |

+--------------------------------+---------------------------------------+



Mon, 02 Oct 2006 06:31:08 GMT  
 Stupid (very) question about menu Widget

  In a message on Wed, 14 Apr 2004 17:31:08 -0500, wrote :

"WL>
"WL> > Hi!
"WL> >
"WL> > I'm trying create one "menu" widget with just this code:
"WL> >
"WL> > menu .bla
"WL> > pack .bla

You don't 'pack' (or grid) a menu widget.

"WL> >
"WL> > Well, I receive one error saying something about toplevel window.
"WL> >
"WL> > So... I use ". configure -menu .bla" and all work fine.
"WL> >
"WL> > Just one question:
"WL> >
"WL> > For my menu be created I ever must use "window configure -menu name_of_menu"??!!
"WL>
"WL> You created it with the menu command.  The configure causes it to be
"WL> displayed.
"WL>
"WL> No, but it is most likely the best way.
"WL>
"WL> > Or I don't make something obvious?
"WL>
"WL> Menus are not like most widgets.  Menus must be hooked to either
"WL> menubuttons (discouraged) or a toplevel (recommended) to be visible.

Or to cascade menu items or fired up from a mouse event (eg pop-up menus,
generally associated with the *right* button).

There are still uses for menubuttons -- to drive *option* or drop-down
menus (eg tk_optionMenu).

"WL>
"WL> --
"WL> +--------------------------------+---------------------------------------+
"WL> | Gerald W. Lester               | "The man who fights for his ideals is |

"WL> +--------------------------------+---------------------------------------+
"WL>                            

                                     \/


http://www.deepsoft.com              /\FidoNet:    1:321/153



Mon, 02 Oct 2006 06:55:05 GMT  
 Stupid (very) question about menu Widget

Quote:

> Hi!

> I'm trying create one "menu" widget with just this code:

> menu .bla
> pack .bla

> Well, I receive one error saying something about toplevel window.

> So... I use ". configure -menu .bla" and all work fine.

> Just one question:

> For my menu be created I ever must use "window configure -menu name_of_menu"??!!

Menus are "top level windows", which means they can't be
packed/placed/gridded inside other widgets like buttons, labels, etc.

What you can do, though, is attach them to other toplevel windows
(specifically, windows created with the "toplevel" command and the
window "."). You can also attach them to menubuttons (see the -menu
option), and have them work as popup menus (see tk_popup).



Mon, 02 Oct 2006 09:01:56 GMT  
 Stupid (very) question about menu Widget

| Menus must be hooked to either menubuttons (discouraged)

Could you elaborate on `discouraged'?

  menubutton .foo -menu .foo.bar
  menu .foo.bar

would be a very common way for me to use menus...

R'



Mon, 02 Oct 2006 16:21:15 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Stupid question about DUIM/widgets

2. Text Widget stupid question ?

3. Using -menu on a toplevel with a non-menu widget

4. menu widget questions

5. Question on menu widget

6. Some questions on elided text in the text widget (and a few other text widget questions)

7. TKinter question - A combo box / menu question

8. Tk Popup Menu in a TkText widget

9. BWidget Dialog widget root menu ???

10. cascade menu as full widget

11. Menu bars and widgets will not activate when window is not active

12. Menu widget with scrollbar

 

 
Powered by phpBB® Forum Software