<p>我是IronPython的新手,尝试用windows窗体创建一个简单的应用程序,它可以将固定字段的文件转换为分隔的文件。在</p>
<p>我创建了一个有三个按钮的窗体。在</p>
<p>首先是选择要转换的文件。
第二种方法是用第一个文件的布局选择一个文件。
第三个是“提交”按钮,将上面两个文件的文件名发送给python函数,该函数将转换文件。在</p>
<p>前两个按钮工作正常。我的问题是将文件名传递给“button_submitPressed”函数。我试图创建FILENAME和LAYOUT全局变量(我在'HelloWorldForm'类内外都尝试过,但都不起作用)。在</p>
<p>如何将在按钮事件中收集的变量传递给另一个函数?在</p>
<p>当我运行这个程序时,当我单击submit按钮(在单击前两个并选择文件名和布局之后),我得到错误:</p>
<pre><code>IronPython.Runtime.UnboundNameException: global name 'FILENAME' is not defined
</code></pre>
<p>谢谢。在</p>
^{pr2}$