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

Incorrect behaviour: plt.show(block=True) with qt5 and jupyter #13302

Closed as not planned
Labels
GUI: Qtstatus: closed as inactiveIssues closed by the "Stale" Github Action. Please comment on any you think should still be open.status: inactiveMarked by the “Stale” Github Action
@vdrhtc

Description

@vdrhtc

Bug report

Bug summary

I'm implementing live plotting for our data acquisition system using Jupyter and FuncAnimation, and have just found an interesting defect inplt.show(block=True) behaviour.

Precisely, it does not unblock when the plot window is closed, and sending KeyboardInterrupt crashes the kernel.

I was able to accidentally fix the first part by modifying theshow() function inbackend_bases.py based onthis forum reply (basically, by not callingmanager.canvas.figure.show() when block is not None, and instead callingmanager.window.setVisible(True) just beforecls.mainloop() since it calls Qt'sexec() that should callshow() by itself)

The second issue persists, though.

Code for reproduction

%pylabqt5importnumpyasnpimportmatplotlib.pyplotaspltfrommatplotlib.animationimportFuncAnimationfig,ax=plt.subplots()xdata,ydata= [], []ln,=plt.plot([], [],'ro')definit():ax.set_xlim(0,2*np.pi)ax.set_ylim(-1,1)returnln,defupdate(frame):xdata.append(frame)ydata.append(np.sin(frame))ln.set_data(xdata,ydata)returnln,ani=FuncAnimation(fig,update,frames=np.linspace(0,2*np.pi,128),init_func=init,blit=True,interval=50)plt.show(block=True)

Actual outcome

Plot window that can be closed by either pressing the corresponding window button or by sending KeyboardInterrupt. The kernel then should be freed.

Expected outcome

The kernel is not freed upon closing (without my fix) and dies on KeyboardInterrupt.

Matplotlib version

  • Operating system: 4.18.16-100.fc27.x86_64
  • Matplotlib version: 3.0.2
  • Matplotlib backend: Qt5Agg
  • Python version: 3.6
  • IPython: 7.2.0
  • Jupyter notebook: 5.7.4

Everything installed with pip in a virtualenv.

Metadata

Metadata

Assignees

No one assigned

    Labels

    GUI: Qtstatus: closed as inactiveIssues closed by the "Stale" Github Action. Please comment on any you think should still be open.status: inactiveMarked by the “Stale” Github Action

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp