12.07.2015 Views

Tkinter reference: A GUI for Python

Tkinter reference: A GUI for Python

Tkinter reference: A GUI for Python

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

To create a menu widget, you must first have created a Menubutton which we will callmb:w = Menu ( mb, *option )This constructor returns a new menu widget. Options include:activebackgroundactiveborderwidthactive<strong>for</strong>egroundbackgroundborderwidthcursordisabled<strong>for</strong>egroundfont<strong>for</strong>egroundpostcommandreliefselectcolortearofftitleThe background color that will appear on a choicewhen it is under the mouse.Specifies the width of a border drawn around achoice when it is under the mouse. Default is 1pixel.The <strong>for</strong>eground color that will appear on a choicewhen it is under the mouse.The background color <strong>for</strong> choices not under themouse. May be abbreviated bg.The width of the border around all the choices. Defaultis 1. May be abbreviated as bd.The cursor that appears when the mouse is over thechoices, but only when the menu has been torn off.The color of the text <strong>for</strong> items whose state isDISABLED.The default font <strong>for</strong> textual choices.The <strong>for</strong>eground color used <strong>for</strong> choices not underthe mouse. May be abbreviated fg.You can set this option to a procedure, and thatprocedure will be called every time someone bringsup this menu.The default 3-D effect <strong>for</strong> menus is RAISED. You canset it to FLAT, SUNKEN, RIDGE, or GROOVE.Specifies the color displayed in checkbuttons andradiobuttons when they are selected.Normally, a menu can be torn off, the first position(position 0) in the list of choices is occupied bythe tear-off element, and the additional choices areadded starting at position 1. If you set this optionto 0, the menu will not have a tear-off feature, andchoices will be added starting at position 0.Normally, the title of a tear-off menu window willbe the same as the text of the menubutton or cascadethat lead to this menu. If you want to change thetitle of that window, set the title option to thatstring.New Mexico Tech Computer Center <strong>Tkinter</strong> <strong>reference</strong>: The Menu widget Page 35

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!