I'm working on a test GUI and need to create a popup menu with 2 buttons after clicking on a button. One of the buttons needs to be disabled and will remain disabled. Here is the code I have so far.
class ButtonPopup(wx.Menu):
def __init__(self, parent):
wx.Menu.__init__(self)
item1 = wx.MenuItem(self, wx.ID_ANY, "Item one")
self.Append(item1)
item2 = wx.MenuItem(self, wx.ID_ANY, "Item two")
item2.Enable(enable=False)
print(str(item2.IsEnabled()))
self.append(item2)
The second item remains enabled which I can verify with the IsEnabled check and can visually see it enabled. I have tried it as item2.Enable(False) as well and item2.Disable() though MenuItem does not use Disable(). I probably missing a dumb mistake or am approaching the popup menu completely wrong so any help would be great.
Below I put the event function to call the popup in case that helps. But if I left everything enabled everything would be working fine.
def open_popup(self, event):
self.PopupMenu(ButtonPopup(self), event.GetEventObject().GetScreenPosition())
