Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Turtle
  • Python PIL
  • Python Program
  • Python Projects
  • Python DataBase
  • Python Flask
  • Python Django
  • Numpy
  • Pandas
  • Python Database
  • Data Science With Python
  • Machine Learning with Python
  • Django
  • Flask
  • R
Open In App
Next Article:
Python Tkinter - Menubutton Widget
Next article icon

Python Tkinter - Menubutton Widget

Last Updated : 26 Mar, 2020
Comments
Improve
Suggest changes
Like Article
Like
Report
Python offers multiple options for developing GUI (Graphical User Interface). Out of all the GUI methods, tkinter is the most commonly used method. It is a standard Python interface to the Tk GUI toolkit shipped with Python. Python with tkinter is the fastest and easiest way to create the GUI applications. Creating a GUI using tkinter is an easy task. Note: For more information, refer to Python GUI – tkinter

Menubutton widget

The Menubutton widget can be defined as the drop-down menu that is shown to the user all the time. The Menubutton is used to implement various types of menus in the python application. Syntax:
w = Menubutton ( master, options )
Parameters:
  • master: This parameter is used to represents the parent window.
  • options:There are many options which are available and they can be used as key-value pairs separated by commas.
Options: Following are commonly used Option can be used with this widget :-
  • activebackground: This option used to represent the background color when the Menubutton is under the cursor.
  • activeforeground: This option used to represent the foreground color when the Menubutton is under the cursor.
  • bg: This option used to represent the normal background color displayed behind the label and indicator.
  • bitmap: This option used to display a monochrome image on a button.
  • bd: This option used to represent the size of the border around the indicator and the default value is 2 pixels.
  • anchor: This option specifies the exact position of the widget content when the widget is assigned more space than needed.
  • cursor: By using this option, the mouse cursor will change to that pattern when it is over the Menubutton.
  • disabledforeground: The foreground color used to render the text of a disabled Menubutton. The default is a stippled version of the default foreground color.
  • direction: It direction can be specified so that menu can be displayed to the specified direction of the button.
  • fg: This option used to represent the color used to render the text.
  • height: This option used to represent the number of lines of text on the Menubutton and it's default value is 1.
  • highlightcolor: This option used to represent the color of the focus highlight when the Menubutton has the focus.
  • image: This option used to display a graphic image on the button.
  • justify: This option used to control how the text is justified: CENTER, LEFT, or RIGHT.
  • menu: It represents the menu specified with the Menubutton.
  • padx: This option used to represent how much space to leave to the left and right of the Menubutton and text. It's default value is 1 pixel.
  • pady: This option used to represent how much space to leave above and below the Menubutton and text. It's default value is 1 pixel.
  • relief: The type of the border of the Menubutton. It's default value is set to FLAT.
  • state: It represents the state of the Menubutton. By default, it is set to normal. We can change it to DISABLED to make the Menubutton unresponsive. The state of the Menubutton is ACTIVE when it is under focus.
  • text: This option used use newlines ("\n") to display multiple lines of text.
  • underline: This option used to represent the index of the character in the text which is to be underlined. The indexing starts with zero in the text.
  • textvariable: This option used to represents the associated variable that tracks the state of the Menubutton.
  • width: This option used to represents the width of the Menubutton. and also represented in the number of characters that are represented in the form of texts.
  • wraplength: This option will be broken text into the number of pieces.
Example: Python3 1==
from tkinter import *  root = Tk() root.geometry("300x200")  w = Label(root, text ='GeeksForGeeks', font = "50")  w.pack()  menubutton = Menubutton(root, text = "Menu")       menubutton.menu = Menu(menubutton)   menubutton["menu"]= menubutton.menu    var1 = IntVar() var2 = IntVar() var3 = IntVar()  menubutton.menu.add_checkbutton(label = "Courses",                                 variable = var1)   menubutton.menu.add_checkbutton(label = "Students",                                 variable = var2) menubutton.menu.add_checkbutton(label = "Careers",                                 variable = var3)    menubutton.pack()   root.mainloop() 
Output:

Next Article
Python Tkinter - Menubutton Widget

S

SHUBHAMSINGH10
Improve
Article Tags :
  • Python
  • Python-tkinter
  • Python Tkinter Widget
Practice Tags :
  • python

Similar Reads

    What are Widgets in Tkinter?
    Tkinter is Python's standard GUI (Graphical User Interface) package. tkinter we can use to build out interfaces - such as buttons, menus, interfaces, and various kind of entry fields and display areas. We call these elements Widgets.What are Widgets in Tkinter?In Tkinter, a widget is essentially a g
    3 min read

    Basic Tkinter Widget

    Python Tkinter - Label
    Tkinter Label is a widget that is used to implement display boxes where you can place text or images. The text displayed by this widget can be changed by the developer at any time you want. It is also used to perform tasks such as underlining the part of the text and spanning the text across multipl
    4 min read
    Python Tkinter - Create Button Widget
    The Tkinter Button widget is a graphical control element used in Python's Tkinter library to create clickable buttons in a graphical user interface (GUI). It provides a way for users to trigger actions or events when clicked.Note: For more reference, you can read our article:What is WidgetsPython Tk
    6 min read
    Python Tkinter - Entry Widget
    Python offers multiple options for developing a GUI (Graphical User Interface). Out of all the GUI methods, Tkinter is the most commonly used method. Python with Tkinter is the fastest and easiest way to create GUI applications. Creating a GUI using Tkinter is an easy task.In Python3 Tkinter is come
    5 min read
    Python Tkinter - Frame Widget
    Python offers multiple options for developing GUI (Graphical User Interface). Out of all the GUI methods, Tkinter is the most commonly used method. It is a standard Python interface to the Tk GUI toolkit shipped with Python. Python with Tkinter is the fastest and easiest way to create GUI applicatio
    3 min read
    Python Tkinter - Checkbutton Widget
    The Checkbutton widget is a standard Tkinter widget that is used to implement on/off selections. Checkbuttons can contain text or images. When the button is pressed, Tkinter calls that function or method. Note: For more reference, you can read our article, What is WidgetsPython Tkinter OverviewPytho
    5 min read
    RadioButton in Tkinter | Python
    The Radiobutton is a standard Tkinter widget used to implement one-of-many selections. Radiobuttons can contain text or images, and you can associate a Python function or method with each button. When the button is pressed, Tkinter automatically calls that function or method.Syntax:   button = Radio
    4 min read
    Python Tkinter - ListBox Widget
    Tkinter is a GUI toolkit used in python to make user-friendly GUIs.Tkinter is the most commonly used and the most basic GUI framework available in python. Tkinter uses an object-oriented approach to make GUIs.  Note: For more information, refer to Python GUI – tkinter ListBox widget The ListBox widg
    2 min read
    Python-Tkinter Scrollbar
    Python offers multiple options for developing a GUI (Graphical User Interface). Out of all the GUI methods, Tkinter is the most commonly used method. It is a standard Python interface to the Tk GUI toolkit shipped with Python. Python with Tkinter is the fastest and easiest way to create GUI applicat
    3 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences