Skip to content

Commit

Permalink
hopefully fixed "no more menus can be allocated"
Browse files Browse the repository at this point in the history
  • Loading branch information
ego-lay-atman-bay committed Aug 7, 2023
1 parent 9301c06 commit a51b736
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '2.3.1'
__version__ = '2.3.2'
__author__ = 'ego-lay-atman-bay'
__credits__ = [
{
Expand Down Expand Up @@ -199,6 +199,7 @@ def __init__(self, parent):

self.createMenubar()
self.createWindow()
self.objectContextMenu = tk.Menu(self.level_canvas, tearoff = 0)

self.loadGame()

Expand Down Expand Up @@ -807,12 +808,17 @@ def unbindObject(self, id):
)

def createObjectContextMenu(self, obj : wmwpy.classes.Object):
menu = tk.Menu(self.level_canvas, tearoff = 0)
menu.add_command(label = 'delete', command = lambda *args : self.deleteObject(obj), accelerator = 'Del')
menu.add_command(label = 'copy', command = lambda *args : self.copyObject(obj), accelerator = f'{crossplatform.shortModifier()}+C')
menu.add_command(label = 'cut', command = lambda *args : self.cutObject(obj), accelerator = f'{crossplatform.shortModifier()}+X')
# try:
# self.objectContextMenu.destroy()
# except:
# log_exception()

return menu
self.objectContextMenu.delete(0, 3)
self.objectContextMenu.add_command(label = 'delete', command = lambda *args : self.deleteObject(obj), accelerator = 'Del')
self.objectContextMenu.add_command(label = 'copy', command = lambda *args : self.copyObject(obj), accelerator = f'{crossplatform.shortModifier()}+C')
self.objectContextMenu.add_command(label = 'cut', command = lambda *args : self.cutObject(obj), accelerator = f'{crossplatform.shortModifier()}+X')

return self.objectContextMenu

def showPopup(self, menu : tk.Menu, event : tk.Event = None, callback : typing.Callable = None):
try:
Expand Down

0 comments on commit a51b736

Please sign in to comment.