I want to create a dropdown menu in tkinter of custom width and height and certain styling options like fore background etc. but when I am running my this code it is giving AttributeError: 'NoneType' object has no attribute 'config'
and when I run my code without config it gives 'TypeError: 'dict_keys' object is not subscriptable
These are my both two codes please help me in this problem.
from tkinter import *
from tkinter import ttk
import tkinter
root=Tk()
root.geometry('500x500')
seletion=StringVar()
def show():
label=Label(root,text=seletion.get()).pack(pady=10)
drop=OptionMenu(root,seletion,'one','two','three',width=10).pack(pady=10)
button=Button(root,text='show',command=show).pack(pady=10)
root.mainloop()
Second code:
from tkinter import *
from tkinter import ttk
import tkinter
root=Tk()
root.geometry('500x500')
seletion=StringVar()
def show():
label=Label(root,text=seletion.get()).pack(pady=10)
pass
drop=OptionMenu(root,seletion,'one','two','three').pack(pady=10)
button=Button(root,text='show',command=show).pack(pady=10)
drop.config(width=10)
root.mainloop()