在我的代码中使用ginput返回错误:matplotlib当前正在使用非GUI后端

时间:2019-02-07 10:41:04

标签: python matplotlib ginput

我试图弄清楚ginput(3)在此代码中的工作方式,但是当我运行它时,它返回一个UserWarning说:“ matplotlib当前正在使用非GUI后端,”

请帮助我。

from PIL import Image
from pylab import *
im = array(Image.open('empire.jpg'))
imshow(im)
print ('Please click 3 points')
x = ginput(3)
print ('you clicked:',x)
show()

用户警告:matplotlib当前正在使用非GUI后端,因此无法显示“ matplotlib当前正在使用非GUI后端,”

1 个答案:

答案 0 :(得分:0)

您可以通过查看this链接来快速了解matplotlib中的后端是指什么。

感谢@ImportanceOfBeingErnest为我提供了必要的资源。

options: Object = {
fileUploadUrl: 'https://localhost:5001/api/file',
events: {
  'froalaEditor.file.beforeUpload': function (e: any, editor: any, files: any) {
    console.log('BEFORE UPLOAD', e, editor, files, files[0]);
  },
  'froalaEditor.file.inserted': function (e, editor, $file, response) {
    console.log('INSERTED', e, editor, $file, response);
  },
  'froalaEditor.file.uploaded': function (e, editor, response) {
    console.log('UPLOADED', e, editor, response);
  },
  'froalaEditor.file.error': function (e, editor, error, response) {
    console.log('ERROR', e, editor, error, response);
  },
}}

如果“ TkAgg”不适合您,则可以按给定的顺序尝试其他GUI后端。

  • WX
  • QTAgg
  • QT4Agg
相关问题