0

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

3
Contributors
5
Replies
44
Views
2 Years
Discussion Span
Last Post by giancan
Featured Replies
  • 1

    You have read http://wiki.wxpython.org/wxPython%20by%20Example#A_Full_Example , haven't you? Read More

0

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

0

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)

0

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.