]> git.phdru.name Git - m_librarian.git/commitdiff
Feat(wx): Create main menu bar, add command "Quit"
authorOleg Broytman <phd@phdru.name>
Sun, 17 Dec 2023 16:45:46 +0000 (19:45 +0300)
committerOleg Broytman <phd@phdru.name>
Sun, 17 Dec 2023 20:44:38 +0000 (23:44 +0300)
[skip ci]

.gitattributes
m_librarian/wx/Application.py

index b7dbfd264a36d61dcdf6eced5b20d09c7100f36c..cf217cc2e689e4abbfea4c2f7a9d975bff0c0ae5 100644 (file)
@@ -1,4 +1,5 @@
 .git* export-ignore
 /README.rus.txt encoding=utf-8
+*.py encoding=utf-8
 *.rst encoding=utf-8
 *.txt text
index d20868cdad6863f96c85a16c119bbf90a76ec199..35575c3880928b7d729b383fe1c3cc51c6fe1ec0 100644 (file)
@@ -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