Any senior please give some advice in wx.html2.WebView

I make a simply interface to load website use wxFormBuilder. It works very well as follow:

    bSizer = wx.BoxSizer(wx.VERTICAL)
    # load website
    self.my_panel = wx.html2.WebView.New(self)
    self.my_panel.LoadURL("http://.....")
    bSizer.Add(self.my_pane, 1, wx.EXPAND | wx.ALL, 2)

Here, I found one problem when I use panel to Load webpage.
The webpage’s size is more bigger than panel’s window size, so every time I only can see the right-up part of webpage in my panel-window. But I am only interested in small area in that-webpage like some table, picture or some small part in other position of that webpage.
have any parameters or function to define the starting location of interested browsing area in big webpage?

Hi xufengzh,
Page zoom (if available) can be set as follows:

    def OnNavigated(self, evt):
        self.my_panel.ZoomType = wx.html2.WEBVIEW_ZOOM_TYPE_LAYOUT
        self.my_panel.Zoom = wx.html2.WEBVIEW_ZOOM_TINY
        self.my_panel.ZoomFactor = 0.5
        evt.Skip()
    self.Bind(wx.html2.EVT_WEBVIEW_NAVIGATED, OnNavigated)

It works fine on my PC (Windows 10 and the backend is IE).

Here are some points to note:
https://docs.wxpython.org/wx.html2.WebView.html#wx.html2.WebView.SetZoomFactor

Thanks komoto48g,

I tried, Zoom can work, thanks. But it looks small words in whole page.

I hop to find a way: read only one small part of page, for example the table or picture in page.
Every time I load the webpage, which start position is always in the top-left of whole page. So my question is that: Is any parameter pos=(100, 100) or function can define the start position of big webpage when I Load it use small panel?

I don’t know how to manually scroll the page, but I don’t think it’s a good idea to specify the scroll position.
I think the best way is to use a permalink like this:

        self.browser.LoadURL("https://docs.wxpython.org/wx.html2.WebView.html"
                             "#wx.html2.WebView.SetZoomFactor")
1 Like

thanks for your advice