#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
#
# generated by wxGlade 0.9.9pre on Thu Jul  9 19:57:28 2020
#

import wx

# begin wxGlade: dependencies
# end wxGlade

# begin wxGlade: extracode
# end wxGlade


class MyFrame(wx.Frame):
    def __init__(self, *args, **kwds):
        # begin wxGlade: MyFrame.__init__
        kwds["style"] = kwds.get("style", 0) | wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.SetSize((400, 300))
        self.SetTitle("frame")

        # Menu Bar
        self.frame_menubar = wx.MenuBar()
        wxglade_tmp_menu = wx.Menu()
        item = wxglade_tmp_menu.Append(wx.ID_ANY, "item1", "")
        self.Bind(wx.EVT_MENU, self.on_menu_item1, item)
        item = wxglade_tmp_menu.Append(wx.ID_ANY, "item2", "")
        self.Bind(wx.EVT_MENU, lambda evt: self.on_menu_item2(), item)
        wxglade_tmp_menu.AppendSeparator()
        item = wxglade_tmp_menu.Append(wx.ID_ANY, "item3", "")
        self.Bind(wx.EVT_MENU, lambda evt: self.on_menu_item345("item3"), item)
        item = wxglade_tmp_menu.Append(wx.ID_ANY, "item4", "")
        self.Bind(wx.EVT_MENU, lambda evt: self.on_menu_item345("item4"), item)
        item = wxglade_tmp_menu.Append(wx.ID_ANY, "item5", "")
        self.Bind(wx.EVT_MENU, lambda evt: self.on_menu_item345("item5"), item)
        self.frame_menubar.Append(wxglade_tmp_menu, "Menu")
        self.SetMenuBar(self.frame_menubar)
        # Menu Bar end

        self.panel_1 = wx.Panel(self, wx.ID_ANY)

        sizer_1 = wx.BoxSizer(wx.VERTICAL)

        static_text_1 = wx.StaticText(self.panel_1, wx.ID_ANY, "This file is for testing menus")
        sizer_1.Add(static_text_1, 0, 0, 0)

        self.text_ctrl_1 = wx.TextCtrl(self.panel_1, wx.ID_ANY, "", style=wx.TE_READONLY)
        sizer_1.Add(self.text_ctrl_1, 0, wx.EXPAND, 0)

        self.panel_1.SetSizer(sizer_1)

        self.Layout()

        # end wxGlade

    def on_menu_item1(self, event):  # wxGlade: MyFrame.<event_handler>
        print("Event handler 'on_menu_item1'")
        self.text_ctrl_1.SetValue("on_menu_item1 called as handler, with event as argument")

    def on_menu_item2(self):
        print("Event handler 'on_menu_item2'")
        self.text_ctrl_1.SetValue("on_menu_item2 called via lambda function")

    def on_menu_items345(self, name):
        print("Event handler 'on_menu_item345'")
        self.text_ctrl_1.SetValue("on_menu_item345 called via lambda function with argument '%s'"%name)


# end of class MyFrame

class MyApp(wx.App):
    def OnInit(self):
        self.frame = MyFrame(None, wx.ID_ANY, "")
        self.SetTopWindow(self.frame)
        self.frame.Show()
        return True

# end of class MyApp

if __name__ == "__main__":
    app = MyApp(0)
    app.MainLoop()
