# GUI setSizePolicy

Hi,

I put these lines

``````    FigureCanvas.setSizePolicy(self,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding)
``````

FigureCanvas.updateGeometry(self)

in the following code, but I have not idea what they do as the GUI seems to behave equivalently (I can resize easily with the mouse) if they are removed.

Any thoughts?

D.

import sys

from PyQt4 import QtGui

import numpy as np

from matplotlib.figure import Figure

from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas

class Qt4MplCanvas(FigureCanvas):

def init(self):

self.fig = Figure()

t = np.arange(0.0, 3.0, 0.01)

s = np.cos(2 * np.pi * t)

self.axes.plot(t, s)

FigureCanvas.init(self, self.fig)

FigureCanvas.setSizePolicy(self,QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Expanding)

FigureCanvas.updateGeometry(self)

qApp = QtGui.QApplication(sys.argv)

fc = Qt4MplCanvas()

fc.show()

sys.exit(qApp.exec_())
{"ft_lang_label":"__label__en","ft_lang_prob":0.5493018,"math_prob":0.93087757,"size":1010,"snap":"2021-43-2021-49","text_gpt3_token_len":258,"char_repetition_ratio":0.16699801,"word_repetition_ratio":0.0,"special_character_ratio":0.21485148,"punctuation_ratio":0.25757575,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9899985,"pos_list":[0,1,2],"im_url_duplicate_count":[null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-10-20T04:49:16Z\",\"WARC-Record-ID\":\"<urn:uuid:49bf8f2d-dbc5-4a7e-bb3e-0f0499af74e3>\",\"Content-Length\":\"12890\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:77f2ee04-e440-46c6-a511-4fbe5f1c497d>\",\"WARC-Concurrent-To\":\"<urn:uuid:8c6a7d14-b7aa-4ac8-89f3-248497d6d89e>\",\"WARC-IP-Address\":\"165.22.13.220\",\"WARC-Target-URI\":\"https://discourse.matplotlib.org/t/gui-setsizepolicy/13016\",\"WARC-Payload-Digest\":\"sha1:D6QY6PTKRVFHPB3SYDEKBYLKW26NIZAB\",\"WARC-Block-Digest\":\"sha1:2ZHFKKWKTIQK5C3OLXTQ4W7YY2D4EOH6\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-43/CC-MAIN-2021-43_segments_1634323585302.56_warc_CC-MAIN-20211020024111-20211020054111-00188.warc.gz\"}"}