From 2caac73aa69120580bc4dc1d5817b9c2c3d05abf Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Thu, 5 Sep 1996 16:46:31 +0000 Subject: Added Menu.insert*() methods [Fred] --- Lib/lib-tk/Tkinter.py | 13 +++++++++++++ Lib/tkinter/Tkinter.py | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py index f43e3d6..1f784fd 100644 --- a/Lib/lib-tk/Tkinter.py +++ b/Lib/lib-tk/Tkinter.py @@ -1255,6 +1255,19 @@ class Menu(Widget): self.add('radiobutton', cnf or kw) def add_separator(self, cnf={}, **kw): self.add('separator', cnf or kw) + def insert(self, index, itemType, cnf={}, **kw): + apply(self.tk.call, (self._w, 'insert', index, itemType) + + self._options(cnf, kw)) + def insert_cascade(self, index, cnf={}, **kw): + self.insert(index, 'cascade', cnf or kw) + def insert_checkbutton(self, index, cnf={}, **kw): + self.insert(index, 'checkbutton', cnf or kw) + def insert_command(self, index, cnf={}, **kw): + self.insert(index, 'command', cnf or kw) + def insert_radiobutton(self, index, cnf={}, **kw): + self.insert(index, 'radiobutton', cnf or kw) + def insert_separator(self, index, cnf={}, **kw): + self.insert(index, 'separator', cnf or kw) def delete(self, index1, index2=None): self.tk.call(self._w, 'delete', index1, index2) def entryconfig(self, index, cnf=None, **kw): diff --git a/Lib/tkinter/Tkinter.py b/Lib/tkinter/Tkinter.py index f43e3d6..1f784fd 100755 --- a/Lib/tkinter/Tkinter.py +++ b/Lib/tkinter/Tkinter.py @@ -1255,6 +1255,19 @@ class Menu(Widget): self.add('radiobutton', cnf or kw) def add_separator(self, cnf={}, **kw): self.add('separator', cnf or kw) + def insert(self, index, itemType, cnf={}, **kw): + apply(self.tk.call, (self._w, 'insert', index, itemType) + + self._options(cnf, kw)) + def insert_cascade(self, index, cnf={}, **kw): + self.insert(index, 'cascade', cnf or kw) + def insert_checkbutton(self, index, cnf={}, **kw): + self.insert(index, 'checkbutton', cnf or kw) + def insert_command(self, index, cnf={}, **kw): + self.insert(index, 'command', cnf or kw) + def insert_radiobutton(self, index, cnf={}, **kw): + self.insert(index, 'radiobutton', cnf or kw) + def insert_separator(self, index, cnf={}, **kw): + self.insert(index, 'separator', cnf or kw) def delete(self, index1, index2=None): self.tk.call(self._w, 'delete', index1, index2) def entryconfig(self, index, cnf=None, **kw): -- cgit v0.12