“WXPython -Menü Callback Stackoverflow” Code-Antworten

WXPython -Menü Callback Stackoverflow

def menuclick(e):
    print(menu.FindItemById(e.Id).Label)
Lovely Louse

WXPython -Menü Callback Stackoverflow

import wx

app = wx.App(False)
frame = wx.Frame(None)

menuBar = wx.MenuBar()
menu = wx.Menu()
menuBar.Append(menu, "&Menu")
frame.SetMenuBar(menuBar)

for name in ['foo','bar','baz']:
    menuitem = menu.Append(-1,"&"+name,name)
    def menuclick(e):
        print(name)
    frame.Bind(wx.EVT_MENU, menuclick, menuitem)

frame.Show(True)
app.MainLoop()
Lovely Louse

Ähnliche Antworten wie “WXPython -Menü Callback Stackoverflow”

Fragen ähnlich wie “WXPython -Menü Callback Stackoverflow”

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen