| 515 | _owns_mainloop = False |
| 516 | |
| 517 | def __init__(self, canvas, num, window): |
| 518 | self.window = window |
| 519 | super().__init__(canvas, num) |
| 520 | self.window.withdraw() |
| 521 | # packing toolbar first, because if space is getting low, last packed |
| 522 | # widget is getting shrunk first (-> the canvas) |
| 523 | self.canvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, expand=1) |
| 524 | |
| 525 | # If the window has per-monitor DPI awareness, then setup a Tk variable |
| 526 | # to store the DPI, which will be updated by the C code, and the trace |
| 527 | # will handle it on the Python side. |
| 528 | window_frame = int(window.wm_frame(), 16) |
| 529 | self._window_dpi = tk.IntVar(master=window, value=96, |
| 530 | name=f'window_dpi{window_frame}') |
| 531 | self._window_dpi_cbname = '' |
| 532 | if _tkagg.enable_dpi_awareness(window_frame, window.tk.interpaddr()): |
| 533 | self._window_dpi_cbname = self._window_dpi.trace_add( |
| 534 | 'write', self._update_window_dpi) |
| 535 | |
| 536 | self._shown = False |
| 537 | |
| 538 | @classmethod |
| 539 | def create_with_canvas(cls, canvas_class, figure, num): |