wx.html.HtmlWindow display wx.Image while others are loading

Hello,

Sorry if the title was a bit confusing, i wasn’t sure what i should put but i will do a much better job explaining my question here. Before i get a bunch of posts linking me to LongRunningTasks i have already read it and implemented its features in my program.

I know that i am not the only person who has noticed that there is a GUI hang when wx.html.HtmlWindow.SetPage is called. I timed it with my program and it is 1.63 seconds. During this time the implemented scroll-bar does not work and im sure you know the other issues that arise with a hung GUI. What i would like to do is immediately load the template, with the unloaded images replaced with one already loaded from wx.Image (unless you know of an easier method). Once the images are loaded it would replace the “loading” image with the proper one.

Currently this is how the program updates the html page:

···

(Non-GUI Thread)

	##Check for Screenshots
ScreenShotList = glob.glob(self._gvars.ScreenImagePath + "%s_*.png"%self._pgrm.id)
if ScreenShotList:
template += "<hr width='75%%'><center>"
for ImagePath in ScreenShotList:
template += "<img src='%s' />"%ImagePath
template += "</center>"
##Apply said page
wx.PostEvent(self._parent, ResultEvent(self._conid.OnSetPage, template))

ResultEvent is in fact the same one from the LongRunningTasks example.
self._conid.OnSetPage just holds the id to connect to.
(GUI Thread)

self.Parent.Connect(-1, -1, GlobalVars._conid.OnSetPage, self.OnSetPage)

GlobalVars._conid.OnSetPage is the same as self._conid.OnSetPage from the Non_GUI Thread.
(GUI Thread)

	def OnSetPage(self, event=None):
self._panels['htmlInfo'].SetPage(event.args[0])

That is how my program is setup currently, before i did just have:

wx.CallAfter(self._child._panels['htmlInfo'].SetPage, template)

inside of the Non-GUI Thread.

If you have any tips or advice i would greatly appreciate it :slight_smile:

Thanks

~Cody


View this message in context: wx.html.HtmlWindow display wx.Image while others are loading

Sent from the wxPython-users mailing list archive at Nabble.com.