From: Oleg Broytman Date: Sun, 17 Dec 2023 16:45:46 +0000 (+0300) Subject: Feat(wx): Create main menu bar, add command "Quit" X-Git-Tag: 0.3.0~9^2~41 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=f3b5f514fff84ab8bcf3b2927ce926206294ec4f;p=m_librarian.git Feat(wx): Create main menu bar, add command "Quit" [skip ci] --- diff --git a/.gitattributes b/.gitattributes index b7dbfd2..cf217cc 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,5 @@ .git* export-ignore /README.rus.txt encoding=utf-8 +*.py encoding=utf-8 *.rst encoding=utf-8 *.txt text diff --git a/m_librarian/wx/Application.py b/m_librarian/wx/Application.py index d20868c..35575c3 100644 --- a/m_librarian/wx/Application.py +++ b/m_librarian/wx/Application.py @@ -1,10 +1,28 @@ +# coding: utf-8 + import wx +class MainWindow(wx.Frame): + + def InitMenu(self): + MenuBar = wx.MenuBar() + self.SetMenuBar(MenuBar) + + file_menu = wx.Menu() + exit = file_menu.Append(wx.ID_EXIT, u"&Выход", u"Выйти из программы") + self.Bind(wx.EVT_MENU, self.OnQuit, exit) + MenuBar.Append(file_menu, u"&Файл") + + def OnQuit(self, event): + self.Close(True) + + class Application(wx.App): def OnInit(self): - frame = wx.Frame(None, -1, u"m_Librarian") + frame = MainWindow(None, -1, u"m_Librarian") + frame.InitMenu() frame.Show(True) self.SetTopWindow(frame) return True