How can I delete any menu items? For example I want to delete "Play".
self.menubar = Menu(self.root)
self.root.config(menu=self.menubar)
self.filemenu2 = Menu(self.menubar)
self.label2=self.menubar.add_cascade(label="Sound", menu=self.filemenu2)
self.menuPlay = self.filemenu2.add_command(label="Play", state=DISABLED, accelerator="Ctrl+P")
self.menuStop = self.filemenu2.add_command(label="Stop", state=DISABLED, accelerator="Ctrl+S")
Menu widgets have a delete method. You can give an index (zero-based), or you can give the label of the item to delete:
self.filemenu2.delete(0) # deletes first item in menu
self.filemenu2.delete("Stop") $ delete item with the label "Stop"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With