Maybe I've missed something here, but doesn't the canvas resize method set the canvas pixel size? This behaves as expected when run standalone from a python prompt.
from qgis.core import * from qgis.gui import * app = QgsApplication([],True) canvas = QgsMapCanvas() canvas.show() canvas.resize(1000,200) canvas.resize(1000,1000) Note the map canvas has no parent, so just appears on its own at the specified size. Or maybe I've missed a point.... On Thu, Jun 30, 2016 at 8:49 PM, Sandro Santilli <s...@kbt.io> wrote: > On Thu, Jun 30, 2016 at 03:24:12AM -0700, Tom Chadwin wrote: >> I asked about this a while back, as I could not get a defined canvas size in >> my tests. I never found an answer, but never understood why it didn't work: >> >> https://lists.osgeo.org/pipermail/qgis-developer/2015-November/040392.html > > Yeah, I feel your pain. It's a frustrating situation indeed. > We'd need an helper class for testcases, to make things like > setting the canvas size easy, and to simulate user events > like mouse moves and clicks, tools selection and the like. > > > --strk; > _______________________________________________ > Qgis-developer mailing list > Qgis-developer@lists.osgeo.org > List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer > Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer _______________________________________________ Qgis-developer mailing list Qgis-developer@lists.osgeo.org List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer