button - Mathematica : Exporting . 通过按钮的 gif 文件

标签 button wolfram-mathematica gif animated-gif

我在使用 Button 导出文件时遇到问题。这段简单的代码只是创建一些数据,即我想要导出为动画 .gif 的 Graphics 列表。

foo = Graphics /@
Table[{GrayLevel[RandomReal[]], Disk[{i, j}, 0.5]},
{k, 50}, {i, 10}, {j, 10}];

现在使用 Export["foo.gif", foo] 导出 foo 可以按预期工作(尽管这需要相当长的时间)。

但是,当我创建一个 Button 时,例如使用 Button["Export!", Export["foo.gif", foo]],单击按钮会导致 Mathematica 卡住一段时间。之后,评估似乎停止了,但什么也没有导出。

我想使用该按钮在 Manipulate 环境中导出类似复杂的图形列表。

感谢您的帮助!

最佳答案

By default, button functions are evaluated on a preemptive link, which times out after 5 seconds

Use Method->"Queued" to evaluate button functions on the main link, which never times out:

Button["Export!", Export["c:\\test.gif", foo], Method -> "Queued"]

enter image description here

关于button - Mathematica : Exporting . 通过按钮的 gif 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12901209/

相关文章:

java - 将我的 textView 的背景设置为 3 个整数的颜色

wolfram-mathematica - 如何模拟 InStr[]?

wolfram-mathematica - 使用 Mathematica 的表函数创建点

iOS 分享 GIF(动画图像)不工作

java - 如何控制 GIF 动画的速度?

python - 在 matplotlib 中提高 gif 分辨率

android - textview文字是按钮的溢出背景

c# - 如何错误处理C#中的过点击

Grails 按钮语法

wolfram-mathematica - 根据 Mathematica 中内部列表元素的字母顺序对列表列表进行排序