Dear friends,
I'm having a strange issue with a simple python code involving wx and HTML2.
It is a code to run a local html page (on windows) but when I close the browser, the process stays in memory and I have to manually kill it.

Here is the code, I hope you can help me.

import wx 
import wx.html2, os

class MyBrowser(wx.Dialog): 
  def __init__(self, *args, **kwds): 
    wx.Dialog.__init__(self, *args, style=wx.MINIMIZE_BOX | wx.MAXIMIZE_BOX | wx.RESIZE_BORDER | wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX) 
    sizer = wx.BoxSizer(wx.VERTICAL) 
    self.browser = wx.html2.WebView.New(self) 
    sizer.Add(self.browser, 1, wx.EXPAND, 10) 
    self.SetSizer(sizer) 
    self.SetSize((800, 700))
    self.SetTitle("GetZ")

if __name__ == '__main__': 
  app = wx.App() 
  dialog = MyBrowser(None, -1)
  dialog.browser.LoadURL("file:///"+os.getcwd()+"/GetZ.htm") 
  dialog.Show() 
  app.MainLoop() 

Thanks for your help,
Gianluca

Any idea?
I still didn't manage to solve it or to understand where the problem is.
Thanks,
G.

Sorry I only have python-wxgtk2.8 in kubuntu :(

Do you have any idea or trick to force closing it completely?
It stays on both if I run it as python script or as exe (converted with py2exe)

Thanks pyTony,
I hadn't look at it carefully untill you pointed me to.
I guess I fixed it just by putting the

self.Bind(wx.EVT_CLOSE, self.OnClose)

Thanks a lot
G.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.