How to change matplotlib backends

Six years later and I came across a similar issue, when trying to decide which backend was available to use. Note see Caveats – below This code snippet works well for me: import matplotlib gui_env = [‘TKAgg’,’GTKAgg’,’Qt4Agg’,’WXAgg’] for gui in gui_env: try: print(“testing”, gui) matplotlib.use(gui,warn=False, force=True) from matplotlib import pyplot as plt break except: continue … Read more

How can I take a screenshot/image of a website using Python?

Here is a simple solution using webkit: http://webscraping.com/blog/Webpage-screenshots-with-webkit/ import sys import time from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.QtWebKit import * class Screenshot(QWebView): def __init__(self): self.app = QApplication(sys.argv) QWebView.__init__(self) self._loaded = False self.loadFinished.connect(self._loadFinished) def capture(self, url, output_file): self.load(QUrl(url)) self.wait_load() # set to webpage size frame = self.page().mainFrame() self.page().setViewportSize(frame.contentsSize()) # render image image … Read more

How to change backends in matplotlib / Python

Six years later and I came across a similar issue, when trying to decide which backend was available to use. Note see Caveats – below This code snippet works well for me: import matplotlib gui_env = [‘TKAgg’,’GTKAgg’,’Qt4Agg’,’WXAgg’] for gui in gui_env: try: print(“testing”, gui) matplotlib.use(gui,warn=False, force=True) from matplotlib import pyplot as plt break except: continue … Read more

Not able to take inputs from HTML form with Node Js

The Express API reference makes the following statement clear (emphasis mine): req.body Contains key-value pairs of data submitted in the request body. By default, it is undefined, and is populated when you use body-parsing middleware such as express.json() or express.urlencoded(). The code sample you posted does not make use of the middlewares the documentation makes … Read more