moved page selection logic to class

This commit is contained in:
2020-11-17 13:11:35 +01:00
parent bd90eb84a5
commit 4fb6cb788f
2 changed files with 7 additions and 2 deletions
+1 -2
View File
@@ -22,8 +22,7 @@ class DAQFrame(wx.Frame):
notebook.AddPage(panel_static, "Static")
notebook.AddPage(panel_scan, "Scan")
last_page = notebook.GetPageCount() - 1 # start on last page (Scan)
notebook.SetSelection(last_page)
panel_main.SetSelection(-1) # start on last page (Scan)
# make sure the window is large enough
sizer = wx.BoxSizer(wx.VERTICAL)
+6
View File
@@ -26,6 +26,12 @@ class NotebookPanel(wx.Panel): #TODO: This needs work
sizer.Add(notebook)
self.SetSizer(sizer)
def SetSelection(self, num):
nb = self.notebook
ntotal = nb.GetPageCount()
num %= ntotal # allow counting from the back using negative numbers
nb.SetSelection(num)
# def __getattr__(self, name):
# return getattr(self.notebook, name)