Python Forum
Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
wx webview event
#1
when a webpage loading, it generates event more than once. Google in the code below, has the event fired twice. some webpage has more than 10 times. it is because of multiple frames or something. I want to wait for page fully loaded before continuing rest process. Is there a way to do it? Thanks.

import wx 
import wx.html2 
 
class MyBrowser(wx.Dialog): 
    def __init__(self, *args, **kwds): 
        wx.Dialog.__init__(self, *args, **kwds) 
        sizer = wx.BoxSizer(wx.VERTICAL) 
        self.browser = wx.html2.WebView.New(self)
        self.Bind(wx.html2.EVT_WEBVIEW_LOADED, self.On_Web_View_Loaded, self.browser)
        sizer.Add(self.browser, 1, wx.EXPAND, 10) 
        self.SetSizer(sizer) 
        self.SetSize((700, 700)) 
    def On_Web_View_Loaded(self, event):
        print('Loading')
if __name__ == '__main__': 
    app = wx.App() 
    dialog = MyBrowser(None, -1) 
    dialog.browser.LoadURL("http://www.google.com") 
    dialog.Show() 
    app.MainLoop()
Reply


Messages In This Thread
wx webview event - by ian - Jun-03-2018, 12:57 AM
RE: wx webview event - by Larz60+ - Jun-03-2018, 01:22 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Clicking on element not triggering event in Selenium Python (Event Key is not in data dkaeloredo 2 4,291 Feb-16-2020, 05:50 AM
Last Post: dkaeloredo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020