微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

pyCharm 无法在禁用“在工具窗口中显示绘图”的情况下打开绘图 - 可能是由于阻塞

如何解决pyCharm 无法在禁用“在工具窗口中显示绘图”的情况下打开绘图 - 可能是由于阻塞

我正在尝试使用 pyCharm(来自 mne)绘制交互式绘图,并禁用了“在工具窗口中显示绘图”。当我运行我的代码时,我看到一个新窗口正在尝试打开,但立即关闭,好像有什么东西挡住了它。我知道这不是绘图本身的问题,因为它在启用“在工具窗口中显示绘图”时有效(但它不是交互式的)。 我不知道是什么阻碍了新窗口,有人知道吗?

我在 Mac(大苏尔)上工作。

谢谢!

解决方法

我遇到了同样的问题,可以通过使用 <script> let monthNames = ["January","February","March","April","May","June","July","August","September","October","November","December"]; var monthNumber = {} for (var i = 0; i < monthNames.length; ++i) { monthNumber[monthNames[i]] = i; } $(document).ready(function () { $('.ui-monthpicker').datepicker({ changeMonth: true,changeYear: true,maxDate: "+0D",dateFormat: 'MM yy',showButtonPanel: true,beforeShow: function() { if ((selDate = $(this).val()).length > 0) { iYear = selDate.substring(selDate.length - 4,selDate.length); iMonth = jQuery.inArray(selDate.substring(0,selDate.length - 5),$(this).datepicker('option','monthNames')); $(this).datepicker('option','defaultDate',new Date(iYear,iMonth,1)); $(this).datepicker('setDate',1)); } },onClose: function() { var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val(); var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val(); // If they don't like the long month format,change the line below to 'M yy' $(this).val($.datepicker.formatDate('MM yy',new Date(year,month,1))); if ($(this).attr("id") == "fromDate") { let fromDate = $("#fromDate").val(); let start = fromDate.split(' '); $('#toDate').datepicker("option","minDate",new Date(start[1],monthNumber[start[0]])); } } }); $('.ui-monthpicker').datepicker("option",new Date(2006,6)); </script> <style> .ui-datepicker-calendar { display: none; } </style> 而不是 plt.show(block=True) 来解决它。这会阻止 python 脚本完成和关闭图形。关闭图窗后,python 脚本将继续运行。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。