Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Windows are not shown with Tk + interactive mode, from matplotlib 3.4 #19935

Open
@kngwyu

Description

@kngwyu

Bug report

Bug summary

The behavior of Tk backend in interactive mode has changed. My code depends on the old behavior and does not work with matplotlib 3.4.

Code for reproduction

importtimeimportnumpyasnpimportmatplotlibasmplfrommatplotlibimportpyplotaspltdeftest_heatmap_draw():mpl.use("TkAgg")plt.ion()DATA_SHAPE=10,10fig=plt.figure()ax=fig.add_subplot()img=ax.imshow(np.zeros(DATA_SHAPE),vmin=-1,vmax=1)for_inrange(10):img.set_data(np.random.uniform(-1,1,DATA_SHAPE))fig.canvas.draw()time.sleep(0.1)if__name__=="__main__":test_heatmap_draw()

Actual outcome
No windows are shown with matplotlib >= 3.4.
I guess that#17789 is the trigger. Insertingself._master.update_idletasks worked, like:

classFigureCanvasTkAgg(FigureCanvasAgg,FigureCanvasTk):defdraw(self):super().draw()self.blit()self._master.update_idletasks()

Expected outcome
The heatmap is interactively updated with matplotlib 3.3.4.

  • Is this change intended? Then I want to know a proper way to write this kind of app. I know thatplt.pause(0.1) works, but actually don't want to pause in my actual use case.
  • If this is not intended, how could I fix backends in a reasonable way?

BTW, thank you for encouraging me ontwitter.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp