Hi Kartic,
K K wrote:
Hello,
I have a wx.Notebook control with 3 pages/tabs. All the three tabs
hold data that are process intensive and it takes a while to display
the UI as all the pages get build.Is it possible to load just the first tab with the data and populate
the remaining tabs only when they are selected? I tried a couple of
things, both of which crashed the interpreter. (I don't whether it was
my data load, which I know works otherwise or whether it is because
assigning a new window to the page causes a fault).
1. Assigning my new loaded panel to the selected tab in the
OnTabSelectionChanged event but this ended crashing the interpreter.
2. Delete the old dummy page and insert a page in its place with the
actual display data. This approach appeared to be sensible but again
the interpreter crashed.Any ideas on how I can have a delayed loading mechanism?
I have seven or eight tabs and as the inital loading takes quit a bit of time I do this:
wx.CallAfter(self.PrepareLoadNotebook)
def PrepareLoadNotebook(self):
"""Create the pages to be loaded, actual loading to the Notebook
is done later (to improve GUI performance - at least impression)
"""
self.statusBar.SetStatusText(number=0, text=_('Preparing - Notebook pages'))
# page1 details page
from nbpage1 import page1Details
self.page1Details = page1Details(id=-1, name='Page 1',
parent=self.NB,
pos=-1, size=-1, style=wx.TAB_TRAVERSAL,
mainframe=self)
self.page1.Hide()
self.MyGcCollect(_('Preparing Notebook - Wine detail page'), 2, self.numOfTabs)
Import all the pages, init them and hide and do a garbage collect to work around a Win98 resource problem. I then load my initial screen which is a listctrl and the notebook with just one tab (welcome screen).
def LoadNotebook(self):
"""Is called from LoadItemData, but really only needs to run once. At startup
the notebook pages are prepared in PreparedNotebook, and a welcome screen is
shown as the first page in the notebook.
"""
if not self.loadNBDone:
wx.BeginBusyCursor()
self.loadNBDone = True
# remove the welcome screen and delete it
self.NB.DeletePage(0)
self.statusBar.SetStatusText(number=0, text=_('Loading Notebook - Page 1 page'))
self.NB.AddPage(select=True, imageId=-1,
page=self.page1Details, text = _('Page 1 Details'))
Currently I load all pages with the respective data in LoadItemData but if I see that this is getting to slow I was thinking of loading each page in its Set_Focus event.
See you
Werner
ยทยทยท
Thank you,
-Kartic---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org