Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8703271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:50:25+00:00 2026-06-13T02:50:25+00:00

Recently I use PyQt4 to crawl some web pages. I want to set different

  • 0

Recently I use PyQt4 to crawl some web pages. I want to set different size of the browser which is generated by QWebView().show(). I tried to use the following code snippet to set the size:

self.qsize = QWebPage().viewportSize()
self.qsize.setHeight(3000)
self.qsize.setWidth(1000)
print self.qsize.height()
print self.qsize.width()

But the browser displayed is always the same size.

Please give me some tips on how to set the size of the browser displayed by QWebView. Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T02:50:26+00:00Added an answer on June 13, 2026 at 2:50 am

    I tested this, the window resizes itself after loadFinished is emitted:

    import sys 
    from PySide.QtCore import QUrl, QSize
    from PySide.QtGui import QApplication, QMainWindow, QWidget
    from PySide.QtWebKit import QWebView
    
    
    class Browser(QMainWindow):
    
        def __init__(self):
            QMainWindow.__init__(self)
            self.resize(300, 300)
            self.web_view = QWebView()
            self.setCentralWidget(self.web_view)
    
            self.web_view.loadFinished.connect(self._load_finished)
    
        def _load_finished(self):
            frame = self.web_view.page().mainFrame()
            self.web_view.page().setViewportSize(frame.contentsSize())
            self.resize(frame.contentsSize())
            html_data = frame.toHtml()
    
    
    if __name__ == '__main__': 
        app = QApplication(sys.argv) 
        browser = Browser() 
        r = QUrl("http://www.yahoo.com")
        browser.web_view.load(r)
        browser.show()
        app.exec_()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I recently wanted to use the jQuery to do some browser detection and
I have recently begun to use the EF v4 Code Only library for some
We recently started to use WebDriver (in favor of Selenium 1) for performing browser
Recently,i want to learn how to use opencv in android,but I stuck in the
I tried recently to use NAnt (beta 0.86.2962.0) to run some unit tests compiled
I'm currently developing with Struts 1 a web application. I've recently started to use
I have recently started to use Web Expression 4. I was under the impression
I recently made use of Backbone as the MVC-framework for the single page web
Recently I use NSTimer to repeat taking photos, it'll show on the screen. This
Recently I use data binding to speed up my development of C# winforms application.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.