bsherin / tacticdocs

Documentation for Tactic text
0 stars 0 forks source link

How to: Technique of capturing TileSizeChange in a matplotlib tile #7

Open bsherin opened 4 years ago

bsherin commented 4 years ago

Perhaps start a section of "how tos" This is code that inserts a select popup after a plot. Note that I subtract 50 from the height so that the popup is visible at bottom. I'm not sure why this works when the tile is initially run. I guess it must be run before the tile is configured.


def TileSizeChange(self, data):
    self.width = data["width"]
    self.height = data["height"] - 50
    if self.configured:
        self.do_resize()
    return None
def do_resize(self):
    print("in my resize")
    self.draw_plot()
    new_html = self.create_figure_html(self._tworker.use_svg)
    new_html += self.selector_func("list", self.select_options)
    self.refresh_tile_now(new_html)
    return