Friday, December 20, 2019

drop down menu in python

# -*- coding: utf-8 -*-
"""
Created on Fri Dec 20 13:15:37 2019

@author: anil durgam
"""

from tkinter import ttk
import tkinter as tk
class Application(ttk.Frame):
   
    def __init__(self, main_window):
        super().__init__(main_window)
        main_window.title("MM32_MENU_SELECTOR")
       
        self.combo = ttk.Combobox(self)
        self.combo.place(x=50, y=50)
        self.combo["values"] = ["MM32F", "MM32L", "MM32SPIN", "MM32W", "MM32P"]
        self.combo.bind("<<ComboboxSelected>>", self.selection_changed)
       
        main_window.configure(width=1024, height=500)
        self.place(width=300, height=200)
       
    def selection_changed(self, event):
        print("your selected::", self.combo.get())
main_window = tk.Tk()
app = Application(main_window)
app.mainloop()

1 comment:

python class topic video